public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "schaub.johannes at googlemail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/47453] New: Various non-conforming behaviors with braced-init-list initialization Date: Tue, 25 Jan 2011 04:12:00 -0000 [thread overview] Message-ID: <bug-47453-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2011-01-25 3:10 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-25 4:12 schaub.johannes at googlemail dot com [this message] 2011-01-25 4:16 ` [Bug c++/47453] " schaub.johannes at googlemail dot com 2011-01-25 5:21 ` schaub.johannes at googlemail dot com 2011-05-12 5:57 ` schaub.johannes at googlemail dot com 2011-07-29 6:09 ` d.v.a at ngs dot ru 2011-07-29 12:24 ` schaub.johannes at googlemail dot com 2011-08-02 3:26 ` d.v.a at ngs dot ru 2011-08-03 18:53 ` [Bug c++/47453] [DR 1214] " jason at gcc dot gnu.org 2011-08-03 19:17 ` schaub.johannes at googlemail dot com 2011-08-05 19:16 ` jason at gcc dot gnu.org 2011-08-05 19:38 ` jason at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-47453-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).