This is the mail archive of the gcc@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]
Other format: [Raw text]

gcc4, namespace and template specialization problem


Hello,

i'm a bit puzzled by the behaviour of gcc4 (old 4.0 & recent 4.1
snapshots) regarding how template specialization should be qualified
wrt namespace:

namespace dummy {
	struct foo {
		template <int i> void f() {}
	};
}
template<> void dummy::foo::f<666>() {}

testcase.cpp:30: error: specialization of 'template<int i> void
dummy::foo::f()' in different namespace
testcase.cpp:27: error:   from definition of 'template<int i> void
dummy::foo::f()'

It has to be written this way:
namespace dummy {
	template<> void dummy::foo::f<666>() {}
or
	template<> void foo::f<666>() {}
}

Other compilers (gcc 3.4.x, msvc2k3, icc8.1) don't whine.
Am i missing something obvious?


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