I encountered unexpected behavior of default constructor. Having this class
class Data {
public:
Data() { std::cout << "default ctor"; }
};
and calling
Data(x);
calls the default constructor, whereas calling
double x;
Data(x);
produces conflicting declaration 'Data x'.
I suppose it is some kind of vexing parse, but I don't see the logic behind that. Can you please explain how the g++ compiler sees that?