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++/54835] New: [C++11] Explicit default constructors not respected during copy-list-initialization


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

             Bug #: 54835
           Summary: [C++11] Explicit default constructors not respected
                    during copy-list-initialization
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


gcc 4.8.0 20120930 (experimental) with the compiler flags

-Wall -pedantic -std=c++11 

accepts the following copy-list-initialization of a class type with an explicit
default constructor:

//-------------------------
struct S {
  explicit S(int = 0) {}
};

S s = {};
//-------------------------

This code should be ill-formed, because it is ruled out by [over.match.list],
in particular by the unconditional wording:

"In copy-list-initialization, if an explicit constructor is chosen, the
initialization is ill-formed."


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