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]

Re: Internal compiler error in template class (fwd)


> (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


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