This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

Templated subclass inside a class causes an internal compiler error



Hi.

When trying to compile the following short piece of code, GCC 2.95.2
halts to an internal compiler error. No compiler options are needed to
cause this problem. 

bug.cpp:

  #include <vector>

  class C {
  	template<class T> 
	class Vec : public vector<T> {
		Vec() { }
	};
  };

The internal compiler error can be avoided by either omitting the
constructor or the class 'C' (but obviously it's not much of a help).

I'm using GCC 2.95.2 under somewhat recent Debian GNU/Linux 2.2
with newest gcc/g++ and libstdc++2.10(-dev) (version 2.95.2-8) packages. 
The host system has an i486-compatible Cyrix 6x86 P166+ cpu. 

I have also reproduced this bug on a Sun Ultra E450 (SunOS 5.6, GCC
2.95.1) so the issue shouldn't be platform-specific.

I attached the preparsed file and original source (for clarity) to
this mail. The compiler output is included at the end of the message body.

Please ask for more information if I forgot to mention something. 

++ Jari

---
Jari Saukkonen + jari.saukkonen@cs.helsinki.fi | Coral
programming, music, keyboards, web, demos,  b5 | Nah-kolor
dazzt @ Majik3D RPG     http://www.majik3d.org | Majik



-- compiler output begin --------------------------------------------

jsaukkon@disko:~/bug$ gcc -v --save-temps bug.cpp
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000313 (Debian GNU/Linux)
 /usr/lib/gcc-lib/i386-linux/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ bug.cpp bug.ii
GNU CPP version 2.95.2 20000116 (Debian GNU/Linux) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i386-linux/2.95.2/../../../../i386-linux/include
End of omitted list.
 /usr/lib/gcc-lib/i386-linux/2.95.2/cc1plus bug.ii -quiet -dumpbase bug.cc -version -o bug.s
GNU C++ version 2.95.2 20000313 (Debian GNU/Linux) (i386-linux) compiled by GNU C version 2.95.2 20000313 (Debian GNU/Linux).
bug.cpp:8: Internal compiler error.
bug.cpp:8: Please submit a full bug report.
bug.cpp:8: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

-- compiler output end ----------------------------------------------

bug.ii.gz

#include <vector>



class C

{

	template<class T> 

	class Vec : public vector<T>

	{

		Vec() { }

	};

};




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