This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: where is the specialization?
- To: yotam_medini at tmai dot com
- Subject: Re: where is the specialization?
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 13 Oct 1997 18:10:14 -0200
- Cc: egcs-bugs at cygnus dot com
- References: <199710131854.LAA08447@telaviv.tmai.com>
Yotam Medini writes:
> Am I missing a new syntax?
Yup. For declaring a template explicit specialization, you must
precede it with `template <args>', even if the list of arguments is
empty. Thus, you should have declared:
template <>
> const char* C<int>::say()
> { return "I am int"; }
template <>
> const char* C<float>::say()
> { return "I am float"; }
Unfortunately, it seems that egcs does not accept this syntax yet. It
says:
test.cc:9: No member template `C' declared in `C<int>'
test.cc:9: No member template `C' declared in `C<int>'
test.cc:9: Specialization of `__as' does not match any template declaration.
test.cc:13: No member template `C' declared in `C<float>'
test.cc:13: No member template `C' declared in `C<float>'
test.cc:13: Specialization of `__as' does not match any template declaration.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil