This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10832: [2003-05-03] Cannot define an out-of-class explicit specialization of a template constructor of a specialized template class.
- From: giovannibajo at libero dot it
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, gprentice at paradise dot net dot nz, nobody at gcc dot gnu dot org
- Date: 17 May 2003 08:00:38 -0000
- Subject: Re: c++/10832: [2003-05-03] Cannot define an out-of-class explicit specialization of a template constructor of a specialized template class.
- Reply-to: giovannibajo at libero dot it, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, gprentice at paradise dot net dot nz, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Old Synopsis: spurious compiler errors for definition of explicit specialisation of template member function of explicitly specialised class
New Synopsis: [2003-05-03] Cannot define an out-of-class explicit specialization of a template constructor of a specialized template class.
State-Changed-From-To: open->analyzed
State-Changed-By: bajo
State-Changed-When: Sat May 17 08:00:38 2003
State-Changed-Why:
Confirmed. I propose the following snippet to show the bug:
-----------------------------------------------------
template <typename DT>
struct Foo;
template <>
struct Foo<int>
{
long h;
template <typename T>
Foo(T);
template <typename T>
void Bar(T);
};
template <>
void Foo<int>::Bar<long>(long v)
{
h = v;
}
template <>
Foo<int>::Foo<long>(long v)
{
h = v;
}
int main()
{
Foo<int> f(12L);
f.Bar(12L);
}
-----------------------------------------------------
pr10832.cpp:23: error: `Foo<long int>' specified as declarator-id
pr10832.cpp:23: error: no member function `Foo<long int>' declared in `Foo<int>'
pr10832.cpp:23: error: invalid function declaration
As you can see, the definition of the specializaiton of
Bar() is accepted, but the same syntax used to specialize
the constructor is rejected. This is obviously a bug.
Confirmed up to current mainline.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10832