public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10515: g++ 3.3 mixes up types when an initialized field in a union is not the first one
@ 2003-04-27 17:36 Andreas Oberritter
0 siblings, 0 replies; only message in thread
From: Andreas Oberritter @ 2003-04-27 17:36 UTC (permalink / raw)
To: gcc-gnats; +Cc: debian-gcc
>Number: 10515
>Category: c++
>Synopsis: g++ 3.3 mixes up types when an initialized field in a union
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Sun Apr 27 17:36:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Andreas Oberritter
>Release: 3.3 20030415 (Debian prerelease) (Debian testing/unstable)
>Organization:
>Environment:
System: Linux shiva 2.4.20-ac2 #1 Sun Jan 5 10:47:07 CET 2003 i686
unknown unknown GNU/Linux
Architecture: i686
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc
i386-linux
>Description:
g++ 3.3 treats members of a union as if they were of the
first member's type. g++ 3.2 and gcc 3.3 can compile it.
>How-To-Repeat:
struct a {
int x;
};
struct b {
int x;
int y;
};
struct foo {
union {
struct a a;
struct b b;
} u;
};
int main(void)
{
struct foo bar = { u: { b: { x: 0, y: 0, }}};
(void)bar;
return 0;
}
$ CXXFLAGS="" CPPFLAGS="" g++-3.3 union_bug.cpp -o union_bug
union_bug.cpp: In function `int main()':
union_bug.cpp:20: error: too many initializers for `a'
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
is not the first one
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-04-27 17:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-27 17:36 c++/10515: g++ 3.3 mixes up types when an initialized field in a union is not the first one Andreas Oberritter
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).