The following code compiles with clang and msvc but not with gcc. It seems gcc does not match the specialisation because of the conversion from signed to unsigned and therefore selects the primary template.
Which compiler is correct? Or is this even UB?
#include <utility>
template<class X>
struct Foo;
template<std::size_t unsigned_integer>
using uint_ = std::integral_constant<std::size_t, unsigned_integer>;
template<int signed_integer> // Doesn't work with gcc.
struct Foo<uint_<signed_integer>> // <- conversion happens here
{
};
// template<int signed_integer>
// struct Foo<uint_<std::size_t(signed_integer)>> // Doesn't work either
// {
// };
// template<std::size_t unsigned_integer>
// struct Foo<uint_<unsigned_integer>> // Works
// {};
int main() {
Foo<uint_<2>> f;
return 0;
}
Live example here.