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/17188] New: struct Foo { }


When an empty structure or union is defined twice, no error is given.

struct Foo { };
struct Foo { };

> gcc-3.4 -std=c99 -pedantic -Wall ~/foo.c
/home/welinder/foo.c:1: warning: struct has no members
/home/welinder/foo.c:2: warning: struct has no members

If I add members, say "int : 1;", I get 

struct Foo { int : 1; };
struct Foo { int : 1; };

> gcc-3.4 -std=c99 -pedantic -Wall ~/foo.c
/home/welinder/foo.c:1: warning: struct has no named members
/home/welinder/foo.c:2: error: redefinition of `struct Foo'
/home/welinder/foo.c:2: warning: struct has no named members


And the mid-point would be...

struct Foo { };
struct Foo { int : 1; };
> gcc-3.4 -std=c99 -pedantic -Wall ~/foo.c
/home/welinder/foo.c:1: warning: struct has no members
/home/welinder/foo.c:2: warning: struct has no named members


Note, that empty structures is a gcc extension.

-- 
           Summary: struct Foo { }
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: terra at gnome dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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