public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47453] New: Various non-conforming behaviors with braced-init-list initialization
@ 2011-01-25  4:12 schaub.johannes at googlemail dot com
  2011-01-25  4:16 ` [Bug c++/47453] " schaub.johannes at googlemail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: schaub.johannes at googlemail dot com @ 2011-01-25  4:12 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-08-05 19:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25  4:12 [Bug c++/47453] New: Various non-conforming behaviors with braced-init-list initialization schaub.johannes at googlemail dot com
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

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).