The compiler interprets MyObject(variable_name) as MyObject variable_name If variable_name exists as an int, this causes a 'redeclaration' error instead of a call to the constructor MyObject::MyObject(int). Am I missing some syntactic aspect here ? The root cause may very well be that e.g. int (variable_name) is accepted by the compiler as a declaration. It doesn't look like one to me.
Redundant parens are always possible.
(In reply to comment #1) > Redundant parens are always possible. They shouldn't always be possible. It is a laxity in the grammar that needlessly causes context dependencies. And, in this case, rejection of a perfectly valid language construct. Even if the context dependency is not removed, the interpretation of 'classname (variablename)' as a constructor call should be considered by the parser.
http://en.wikipedia.org/wiki/Most_vexing_parse