I'm working on a simple set of classed to represent predicate logic. While I was writing the first few bits I ran across something strange.
My Particle class has a copy constructor defined as:
Code:
Particle(const Particle& p)
When I passed (as a random test) a pointer to this constructor it worked perfectly instead of causing the expected compiler error.
I tried writing a skeleton class to reproduce the effect (called A in the files) so I could post it here for explanations but this class causes the compiler to produce this error
Code:
main.cpp: In function `int main()':
main.cpp:63: error: no matching function for call to `A::A(A*&)'
main.cpp:11: note: candidates are: A::A(const A&)
main.cpp:7: note: A::A()
I then tried the same thing with the assignment operator and obtained exactly the same results: Particle works and A fails.
Below are links to the source files. I didn't post the directly because it's rather long.
main.cpp
logic.h
logic_proposition.h
logic_particle.h
[edit]
I just realised I forgto to include the settings.h file which is only 2 #defines:
#define SETTING_PRINTABLE
#define SETTING_DEBUG
if #include "settings.h" is removed the code will still work except for the commented out test() function, just without the debug output
[/edit]