template related bug

Walter Brisken walterfb@puppsr14.princeton.edu
Fri May 21 21:51:00 GMT 1999

#include <list>

class newtype
	list<int> l;

int crash(list<newtype> l)
	int d;
	list<newtype>::iterator i;
	for(i = l.begin(); i != l.end(); i++)
		d += i->list.size();
	return d;

Compiling this crashes.  There is an intentional typo : list.size() should
be l.size();

EGCS versions:
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/pgcc-2.91.66/specs
gcc version pgcc-2.91.66 19990314 (egcs-1.1.2 release)

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

Command line:  g++ -Wall -c crash.cc

Dual pentium MMX / Redhat 6.0 / kernel 2.2.9 / glibc 2.1.1

% g++ -Wall crash.cc -c
crash.cc: In function `int crash(class list<newtype,__default_alloc_template<true,0> >)':
crash.cc:13: Internal compiler error.
crash.cc:13: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
crash.cc:13: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for details.

I have prepared a crash.ii file, but it sould be very easy to duplicate 
this problem.  If anyone wants the crash.ii, please let me know.



More information about the Gcc-bugs mailing list