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/40136] New: Initializing a union whose first member is an anonymous struct


Not sure if this is a bug or a standards interpretation issue.  Consider the
following union, whose first member is an anonymous struct:

union Foo {
    struct { float a,b,c; };
    const char* x;
};

icc (10.1) permits initialization of the first member of the union:

Foo foo = { .0f, .0f, .0f };

gcc (4.0.1) doesn't permit that, but does permit the following, which I believe
should not be accepted:

Foo foo = { "foo" };


-- 
           Summary: Initializing a union whose first member is an anonymous
                    struct
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markleone at gmail dot com
  GCC host triplet: i686-apple-darwin9-gcc-4.0.1


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


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