c++/4232: template instantiation in function body using a template argument fails

Alexandre Oliva aoliva@redhat.com
Sun Sep 9 13:41:00 GMT 2001


On Sep  9, 2001, Philip Martin <philip_martin@ntlworld.com> wrote:

> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4232&database=gcc

> This is not a gcc bug, your code is invalid.

Not really.  The `template' keyword should only be required below in
case the type of `f' was dependent on template arguments.  But this is
not the case, so `template' is optional.  Using it is just a
work-around for GCC.

>    template <typename _type>
>    _type moo( const foo& f ) { return f.template cast_foo<_type>(); }

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-bugs mailing list