This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc4, namespace and template specialization problem
On Mon, Apr 04, 2005 at 01:08:37PM +0200, tbp wrote:
> On Apr 4, 2005 1:04 PM, Jonathan Wakely <cow@compsoc.man.ac.uk> wrote:
> > Hope that helps,
> Yes, thanks and for once gcc warning was explicit enough (with a hint
> about namespace) for me to fix it.
:-)
It might be even better if the error indicated that only the definition
needs to be in the same namespace.
What I mean is that GCC rejects the following code saying:
test.cc:7: error: specialization of `template<int i> void dummy::foo::f()' in different namespace
test.cc:3: error: from definition of `template<int i> void dummy::foo::f()'
but actually the specialisation and definition are both in the global
namespace:
namespace dummy {
struct foo {
template <int i> void f();
};
}
template <int i> void dummy::foo::f() {}
template<> void dummy::foo::f<666>() {}
The error is that the specialisation is in a different namespace from
the declaration, not the definitionn.
Does anyone agree? Should I file a PR?
jon
--
"Reality is that which, when you stop believing in it, doesn't go away."
- Phillip K. Dick