This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]