Reputation: 11181
Consider this minimal example:
template<class X> struct foo;
template<>
struct foo<int>
{
template<class = void>
static constexpr int x = 0;
};
template<class T>
constexpr int foo<int>::x<T>;
The last two lines are needed because otherwise we will get an undefined reference when the variable x
is ODR-used.
While gcc (6.2.1) is happy to compile this code, clang (3.9.0) fails on the last line with this cryptic message:
error: variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list
Which one is the correct behavior?
Upvotes: 0
Views: 82