public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/19079] New: Unamed struct/union issues with typedef
@ 2004-12-19 12:58 frantas at brfree dot com dot br
2004-12-19 13:16 ` [Bug c/19079] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: frantas at brfree dot com dot br @ 2004-12-19 12:58 UTC (permalink / raw)
To: gcc-bugs
The following code generates an error with gcc-3.4.3. It compiles fine with
gcc-3.2.3. Please see the comments in the code.
--------------- code -----------------
typedef union { int b; float c; } MyUnionType;
MyUnionType bar;
struct {
int a;
union {
int b;
float c;
};
int d;
} foo;
struct {
int a;
MyUnionType x;
int d;
} foo1;
struct {
int a;
MyUnionType; /* here we get a warning */
int d;
} foo2;
void test(void) {
bar.b = 1; /* the typedef works */
foo.b = 2; /* the unamed union in the struct works */
foo1.x.b = 3; /* the typedefed union in the struct works */
foo2.b = 4; /* but not if unamed - here we get an error */
}
---------------- end of code --------------------
---------------- compiler output ----------------
Reading specs from /opt/gcc/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: ../configure --prefix=/opt/gcc
Thread model: posix
gcc version 3.4.3
/opt/gcc/libexec/gcc/i686-pc-linux-gnu/3.4.3/cc1 -E -quiet -v unamedstruct.c
-mtune=pentiumpro -o unamedstruct.i
ignoring nonexistent directory
"/opt/gcc/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/opt/gcc/include
/opt/gcc/lib/gcc/i686-pc-linux-gnu/3.4.3/include
/usr/include
End of search list.
/opt/gcc/libexec/gcc/i686-pc-linux-gnu/3.4.3/cc1 -fpreprocessed unamedstruct.i
-quiet -dumpbase unamedstruct.c -mtune=pentiumpro -auxbase unamedstruct -version
-o unamedstruct.s
GNU C version 3.4.3 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.3 (release).
GGC heuristics: --param ggc-min-expand=62 --param ggc-min-heapsize=60386
unamedstruct.c:22: warning: declaration does not declare anything
unamedstruct.c: In function `test':
unamedstruct.c:30: error: structure has no member named `b'
-------------end of compiler output -------------
--
Summary: Unamed struct/union issues with typedef
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: frantas at brfree dot com dot br
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19079
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/19079] Unamed struct/union issues with typedef
2004-12-19 12:58 [Bug c/19079] New: Unamed struct/union issues with typedef frantas at brfree dot com dot br
@ 2004-12-19 13:16 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-19 13:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-19 13:16 -------
Invalid, this was done on purpose, use -fms-extension to get back the old behavior.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19079
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-12-19 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-19 12:58 [Bug c/19079] New: Unamed struct/union issues with typedef frantas at brfree dot com dot br
2004-12-19 13:16 ` [Bug c/19079] " pinskia 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).