🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #5972

Struct/enum tag namespace bug in gcc

#5972
From: Tim Wadsworth
Date: Fri, 17 Jan 1997 00:00
28 lines
1225 bytes
According to the ANSI C standard, 6.1.2.3, tags of structures, unions
and enumerations belong to the same namespace.

Thus, the following program should not compile, because tag XXX
is redefined:

====================
struct XXX {
  int member;
};
 
enum XXX {
  enum_value1, enum_value2
};
 
main () {
}
====================

It does compile, however, under gcc 2.7.2, whether -ansi is
specified or not.

The redefinition is detected correctly by the sunpro compiler, and
gcc itself does detect it if the enum is encountered before the
struct - ie. it is order dependent!

Tim.
Technical Details
Message-ID: <32DF9D8E.4ED1@cambridge.simoco.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,23d0703691c2b885,start
X-Google-Attributes: gid113d02,public
From: Tim.Wadsworth@cambridge.simoco.com (Tim Wadsworth)
Subject: Struct/enum tag namespace bug in gcc
Date: 1997/01/17
Message-ID: <32DF9D8E.4ED1@cambridge.simoco.com>
X-Deja-AN: 210439471
sender: bug-gcc-request@prep.ai.mit.edu
content-type: text/plain; charset=us-ascii
organization: Simoco Telecom
x-gateway: relay2.UU.NET from bug-gcc to gnu.gcc.bug; Fri, 17 Jan 1997 10:57:23 EST
mime-version: 1.0
newsgroups: gnu.gcc.bug
x-mailer: Mozilla 2.0 (X11; I; SunOS 5.5 sun4m)