This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Internal compiler error in template class (fwd)
- To: filmil at polip dot psc dot ac dot yu
- Subject: Re: Internal compiler error in template class (fwd)
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sat, 23 Oct 1999 13:13:29 +0200
- CC: egcs-bugs at egcs dot cygnus dot com
- References: <Pine.LNX.3.96.991021021148.1604A-100000@polip.psc.ac.yu>
> (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