public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66644] New: Rejects C++11 in-class anonymous union members initialization
@ 2015-06-23 19:02 bisqwit at iki dot fi
  2015-06-23 19:03 ` [Bug c++/66644] " bisqwit at iki dot fi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bisqwit at iki dot fi @ 2015-06-23 19:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66644

            Bug ID: 66644
           Summary: Rejects C++11 in-class anonymous union members
                    initialization
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bisqwit at iki dot fi
  Target Milestone: ---

Accepted by GCC:

    struct test  
    {   union  
        {
            struct { char a=0, b; };
            char buffer[16];
    };  };

NOT accepted by GCC (multiple fields in union 'test::<anonymous union>'
initialized):

    struct test  
    {   union  
        {
            struct { char a=0, b=0; };
            char buffer[16];
    };  };

Still accepted by GCC:

    struct test
    {   union
        {
            struct { char a, b; } test2{0,
            char buffer[16];
    };  };

I think there's a compiler bug here. It should not complain about initializing
multiple fields in a struct that is nested inside the union, because this does
not comprise a conflict.

Tested on GCC versions 4.7.4, 4.8.4, 4.9.2, and 5.1.1.


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

end of thread, other threads:[~2015-07-08 14:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 19:02 [Bug c++/66644] New: Rejects C++11 in-class anonymous union members initialization bisqwit at iki dot fi
2015-06-23 19:03 ` [Bug c++/66644] " bisqwit at iki dot fi
2015-06-24 20:12 ` daniel.kruegler at googlemail dot com
2015-06-25 13:55 ` redi at gcc dot gnu.org
2015-07-08 14:32 ` paolo.carlini at oracle dot com

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