Internal compiler error in template class (fwd)
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Sun Oct 31 23:03:00 GMT 1999
> (I hope you check this out asap since my work is on hold :)
Thanks for your bug report. Please note that egcs 1.0 is a very old
compiler. gcc-2.95.1 detects a number of errors in your program,
instead of crashing:
In file included from matrix_base.cc:7:
matrix_base.h:30: partial specialization `matrix_base<T>' does not specialize any template arguments
matrix_base.h:41: declaration of `class T'
matrix_base.h:29: shadows template parm `class T'
...
Here are some of the errors you made:
template <class T>
class matrix_base<T> {
In a declaration of a class template, you don't give a template list
after the class name. Instead, you write
template <class T>
class matrix_base {
Further, in declaration of a constructor, you don't give a return
type:
template<class T>
matrix_base( int x = 2, int y = 2 , int zero = 0);
Instead, you write
matrix_base( int x = 2, int y = 2 , int zero = 0);
and so on. When fixing all the errors, g++ 2.95.1 compiles your code
just fine; I suggest to upgrade.
Regards,
Martin
More information about the Gcc-bugs
mailing list