🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41628

bug with respect to same overloading class

#41628
From: Ferdinand de Bouvere
Date: Thu, 29 Feb 1996 00:00
41 lines
1559 bytes
I discovered a problem in gcc that probably is a bug.
the following code has two identifiers 'test' which are
in the same overloading class (or name space) and are 
for that reason not allowed.
See lines 3 and 11

1    main()
2    {
3        struct test {
4            double test;
5            char *s;
6            int n;
7            long l;
8            float f;
9        };
10
11       enum test { a, b, c, d, etc };
12
13       printf("%d\n", sizeof (struct test));
14   }

However, gcc compiles fine and prints 4 on an intel.
this is absolutely not equal to sizeof(struct test).
After changing 'test' in line 11, or even removing it, all is
working perfect.
Putting line 11 (enum test ...) before the structure (line 3)
causes the compiler to exit with a correct error message.

gcc version 2.6.3 
lib version 4.6.27

I did not have access to newer compilers at the moment.
Is there anybody who wants to check this on another version.

gcc on HP/UX (version 2.5.? ) shows the same problem.
Every non-gcc compiler exits with the right compile error.

Ferdi
<bouvere@nikhefk.nikhef.nl>
<ferdinan@htsa.hva.nl>
Technical Details
Message-ID: <1996Feb29.145935.22277@paramount.nikhefk.nikhef.nl>
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: 11318c,9bac252125fe6aa6,start
X-Google-Attributes: gid11318c,public
From: bouvere@paramount.nikhefk.nikhef.nl (Ferdinand de Bouvere)
Subject: bug with respect to same overloading class
Date: 1996/02/29
Message-ID: <1996Feb29.145935.22277@paramount.nikhefk.nikhef.nl>
X-Deja-AN: 141604474
organization: NIKHEFK
newsgroups: gnu.gcc.help