[Bug c++/51747] New: [C++11] cannot call copy constructor using list-initialization

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 3 22:04:00 GMT 2012


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

             Bug #: 51747
           Summary: [C++11] cannot call copy constructor using
                    list-initialization
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org
                CC: jason@gcc.gnu.org


struct X {
   X() = default;
   X(const X&) = default;
#ifdef OK
   X(int) { }
#endif
};

X x;
X x2{x};

t.cc:10:7: error: too many initializers for 'X'

(It compiles fine if OK is defined.)

Should overload resolution choose the copy constructor?
If not, could there be a better diagnostic?



More information about the Gcc-bugs mailing list