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++/51805] New: Invalid list-initialization accepted


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

             Bug #: 51805
           Summary: Invalid list-initialization accepted
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schaub.johannes@googlemail.com


Either I'm missing something or GCC should reject this code according to
13.3.3.1p4 (the initializer-list constructor is non-viable and the copy/move
constructors would require user defined conversions respectively to accept "{1,
2, 3}"):

  struct A { A(initializer_list<int>); }; A a{{1, 2, 3}};

People were initializing their vectors using "{{1, 2, 3}}", perhaps they are
used to do such by following the analogous "array<>" initialization notion.


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