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 9


As a follow up to myself...

Alexandre Oliva <oliva@dcc.unicamp.br> writes:

> Claus Fischer <cfischer@td2cad.intel.com> writes:

>> template <class Number> class Matrix { friend product<Number>(); };

> This compiles fine with the latest pre-1.1 snapshot.

... but it shouldn't.  You should have to pre-declare the template
outside the template class body in order to be able to refer to it as
product<Number>() inside the template class body.

template <class Number> int product();
template <class Number> class Matrix ...

Furthermore, a return type must be specified when you declare a
function; the implicit int rule no longer holds in C++ (but g++
accepts it as an extension; it will emit a warning with -Wall)

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



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