This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Template bug ?
- To: "Munagala V. S. Ramanath" <ram at netcom dot com>
- Subject: Re: Template bug ?
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 05 Jan 1998 14:16:58 -0200
- Cc: egcs-bugs at cygnus dot com
- References: <199801051556.HAA13934@netcom17.netcom.com>
Munagala V S Ramanath writes:
> When I add <> after the function names at lines 14 and 15 as suggested
> by the diagnostic I get further errors:
> ------------------------------------------------------------------------
> ram@dust tests: /d2a/exper/bin/gcc bug2.C -lstdc++
> bug2.C:13: parse error before `>'
there must be a declaration of the function template before it is
referred to inside the body of the class template. In order to
declare the function template before the definition of the class
template, you must have already declared the class template, like
this:
template< class T, class UT, int NFRAC >
class Fixed;
template< class T, class UT, int NFRAC > inline Fixed< T, UT, NFRAC >
Mul( const Fixed< T, UT, NFRAC > &a1,
const Fixed< T, UT, NFRAC > &a2 );
template< class T, class UT, int NFRAC > ostream &
operator<<( ostream &os, const Fixed< T, UT, NFRAC > &a );
template< class T, class UT, int NFRAC >
class Fixed {
// ...
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil