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: where is the specialization?


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


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