Simpletron s();
This is a classic case of "vexing parse"; for the compiler, you are not creating a variable s
of type Simpletron
, but you are declaring a function named s
, taking no parameters and returning a Simpletron
object.
This comes from the fact that this expression could be interpreted both as a function declaration and as a variable declaration; since to declare the variable there's an easy alternative (namely, just omit the parentheses) the standard mandates to interpret this as a function declaration.
This passes without problems the compiling phase (the compiler doesn't need to have the definitions of all the methods, just the declarations), and probably the linker doesn't give any error since no instance of Simpletron
is actually created, so it never needs to actually look for the constructor definition (although I don't think that it's guaranteed not to give errors, a particularly thorough compiler/linker couple should be able to give you an error for the missing constructor anyway).