------- Additional Comments From redi at gcc dot gnu dot org 2005-10-01 14:18
-------
Matthew has a point about "Hidden<int>" being confusing in the diagnostic, as
Hidden is not a template.
I notice if you define the Hidden constructor inline in the Hide<int>::Hidden
class body then it works (with Comeau as well, if you move the Hide<T> ctor
after the Hide<int>::Hidden definition to avoid the first error.)
This is because Hide<int>::Hidden is not a template, so the definition of the
Hidden ctor should not have "template<>" before it - it's not a template
specialisation, it the definition of a non-template function.
However, GCC wrongly rejects the code if you remove the "template<>" (which
might already be filed as a bug, I can't remember):
pr24139.cc:27: error: explicit specialization of
Hide<int>::Hidden<int>::Hidden() must be introduced by template <>
pr24139.cc:27: error: template-id Hidden<> for
Hide<int>::Hidden<int>::Hidden() does not match any template declaration
pr24139.cc:27: error: invalid function declaration
The first line is wrong, it is not an explicit specialisation.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |redi at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24139