[Bug c++/52071] New: Constructor invocation confused

jyates at us dot ibm.com gcc-bugzilla@gcc.gnu.org
Tue Jan 31 21:21:00 GMT 2012


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

             Bug #: 52071
           Summary: Constructor invocation confused
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jyates@us.ibm.com


struct C1 {
    C1(int);
};

struct C2 {
    C2();
    C2(C1);
};

void f()
{
    int x;
    int y = 1;
    C2  vc;

    // No problem
    vc = C2(C1(x = y));

    // local variable 'y' may not appear in this context
    // default arguments are only permitted for function parameters
    vc = (C2(C1(x = y)));

    // No problem
    vc = (C2(C1((0, x = y))));
}



More information about the Gcc-bugs mailing list