imagine the following sudo like code

class A
{
A();
A(int, int);
};

main
{
A varname; // no problem
A varname(1, 2); // no problem

A varname(); // problem !!!
}

Why can't you use the so called optional parenthesis in this example?

My first thought was the compiler sees this as invalid chars for the variable name, but this compiles.

So i added a line after the problem statement using the varname and then it won't compile.

This leaves me to beleive that the compiler just ignores the problem statement if you don't acually use it. By the way this is the same for g++ as well as msvc compilers.

So, is there a good reason why this won't just call the default constructor?

Just curious ...