public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7945: ICE at cp/cp-lang.c:130 for struct initialization
@ 2002-09-17 2:26 msmakela
0 siblings, 0 replies; only message in thread
From: msmakela @ 2002-09-17 2:26 UTC (permalink / raw)
To: gcc-gnats, debian-gcc
>Number: 7945
>Category: c++
>Synopsis: initializing a struct having a class component fails
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Tue Sep 17 02:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Marko Makela
>Release: 3.2.1 20020830 (Debian prerelease) (Debian testing/unstable)
>Organization:
Helsinki University of Technology
>Environment:
System: Linux siphon 2.4.3 #4 Mon Apr 9 12:53:30 EEST 2001 i686 unknown unknown GNU/Linux
Architecture: i686
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: /mnt/data/gcc-3.1/gcc-3.2-3.2.1ds0/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-java-gc=boehm --enable-objc-gc i386-linux
>Description:
If a struct has a class-valued component, initializing an instance
of the struct by using a brace-delimited initialization expression
triggers an ICE in cp_expr_size, at cp/cp-lang.c:130. It seems that
there must be an explicit declaration of both a copy constructor and
an assignment operator for the class in order for the bug to occur.
>How-To-Repeat:
The following code is a reduced test case that fails on this version
of the compiler. It seems to work in g++ (GCC) 3.2.1 20020905
(prerelease) on SunOS 5.8, so you may want to ignore this report.
class C
{
public:
C ();
C (const class C& old);
class C& operator= (const class C& old);
};
struct s
{
class C c;
};
void
f (void)
{
class C c;
struct s s = { c };
}
>Fix:
Declare the struct with a pointer or a reference instead, or
do not declare a copy constructor or operator=() for the class.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-09-17 9:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-17 2:26 c++/7945: ICE at cp/cp-lang.c:130 for struct initialization msmakela
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).