[Bug c++/49692] New: Constructor call mistaken for declaration

kortink at inter dot nl.net gcc-bugzilla@gcc.gnu.org
Sat Jul 9 21:10:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49692

           Summary: Constructor call mistaken for declaration
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kortink@inter.nl.net


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.



More information about the Gcc-bugs mailing list