where is the specialization?

Alexandre Oliva oliva@dcc.unicamp.br
Mon Oct 13 13:15:00 GMT 1997


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



More information about the Gcc-bugs mailing list