This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/7945: ICE at cp/cp-lang.c:130 for struct initialization

>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
>Originator:     Marko Makela
>Release:        3.2.1 20020830 (Debian prerelease) (Debian testing/unstable)
Helsinki University of Technology
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
	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.
	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
  C ();
  C (const class C& old);
  class C& operator= (const class C& old);

struct s
  class C c;

f (void)
  class C c;
  struct s s = { c };

Declare the struct with a pointer or a reference instead, or
	do not declare a copy constructor or operator=() for the class.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]