This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/17188] New: struct Foo { }
- From: "terra at gnome dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Aug 2004 18:27:21 -0000
- Subject: [Bug c/17188] New: struct Foo { }
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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