This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: specialization of implicitly-declared special member function
- To: nbecker at fred dot net
- Subject: Re: specialization of implicitly-declared special member function
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Thu, 10 Sep 1998 18:20:44 -0700
- CC: egcs at cygnus dot com
- References: <E0zHBaV-0007Db-00@hns.com>
- Reply-to: mark at markmitchell dot com
>>>>> "nbecker" == <nbecker@fred.net> writes:
nbecker> Is this really an error? (Where is a copy of the
nbecker> standard available?)
nbecker> template<class T> class A { public: template<class I> A
nbecker> (const I& a, const I& b); template<> A (int a, int b); };
Yes, it's really an error, but the message was bad. In current
versions of EGCS you get:
test6.C:6: explicit specialization in non-namespace scope `A<T>'
which is the correct error. You have to write something like:
template<class T>
class A {
public:
template<class I> A (const I& a, const I& b);
};
template<>
template<>
A<int>::A(const int& a, const int& b)
{
}
Note that you cannot write:
template <class T>
template<>
A<T>::A(const int& a, const int& b)
{
}
This meets (correctly) with the error:
test5.C:8: enclosing class templates are not explicitly specialized
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com