The following code compiles in Clang, but not in GCC:
template<typename T> struct Widget { template<typename U> void foo(U) { } template<> void foo(int*) { } };
According to the C ++ standard ([temp.expl.spec], paragraph 2):
Explicit specialization can be declared in any field in which the corresponding primary pattern can be used.
Is this a bug in GCC, and if so, how can I find it in my bug tracker?
This is the output of GCC:
prog.cc:13:14: error: explicit specialization in non-namespace scope 'struct Widget<T>' template<> ^
I am using GCC HEAD 8.0.1 with -std=c++2a .
source share