public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17188] New: struct Foo { }
@ 2004-08-25 18:27 terra at gnome dot org
  2004-08-25 18:41 ` [Bug c/17188] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: terra at gnome dot org @ 2004-08-25 18:27 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2005-07-28 23:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-25 18:27 [Bug c/17188] New: struct Foo { } terra at gnome dot org
2004-08-25 18:41 ` [Bug c/17188] " pinskia at gcc dot gnu dot org
2004-08-25 22:41 ` bangerth at dealii dot org
2004-08-25 23:32 ` pinskia at gcc dot gnu dot org
2004-09-17  2:28 ` [Bug c/17188] struct Foo { } redefinition giovannibajo at libero dot it
2004-09-17  3:14 ` pinskia at gcc dot gnu dot org
2004-09-24 17:22 ` cvs-commit at gcc dot gnu dot org
2004-09-24 17:34 ` pinskia at gcc dot gnu dot org
2005-07-28 23:03 ` cvs-commit at gcc dot gnu dot org
2005-07-28 23:12 ` jsm28 at gcc dot gnu dot 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).