From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3193 invoked by alias); 25 Jan 2011 03:10:52 -0000 Received: (qmail 3141 invoked by uid 22791); 25 Jan 2011 03:10:51 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Jan 2011 03:10:47 +0000 From: "schaub.johannes at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/47453] New: Various non-conforming behaviors with braced-init-list initialization X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: schaub.johannes at googlemail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 25 Jan 2011 04:12:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg02563.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47453 Summary: Various non-conforming behaviors with braced-init-list initialization Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: schaub.johannes@googlemail.com According to n3225, GCC is apparently not conforming to the latest specs. The following points out some flaws. // should be invalid (takes bullet 5 of 8.5p16, for data-member a) // incorrectly accepted by GCC. struct A { int a[2]; A():a({1, 2}) { } }; The spec is not clear about what behavior the following should exhibit according to 8.5p16. As long as it's not cleared up, GCC should reconsider whether it's desirable to accept it, it seems: int a({0}); // spec is not clear. doesn't define this case? The following is ill-formed, because it takes bullet 2 and then hits 8.5.3p1: int const &b({0}); // incorrectly accepted by GCC If both of those have different meanings with regard to validity, this is very disgusting. In short, the intent seems to be that a "({ ... })" initializer is only allowed for class types, where it will hit 8.5.16p6. That's the only valid way such an initialize can be interpreted for classes, in order not to accept the following struct A { explicit A(int, int); }; A a({1, 2}); // this must be invalid, and GCC correctly rejects it. In the end, I think the spec is very unclear about this, and GCC possibly should reconsider some of its behavior here.