Skip to content

Instantly share code, notes, and snippets.

@marzer
Created September 19, 2021 18:44
Show Gist options
  • Save marzer/b20752bde5f30995ceea71370ebbba1a to your computer and use it in GitHub Desktop.
Save marzer/b20752bde5f30995ceea71370ebbba1a to your computer and use it in GitHub Desktop.
MSVC Template partial specialization bug repro
template <typename T>
struct type_and_nttps
{
static constexpr bool value = false;
};
template <template <typename> typename T, typename U>
struct type_and_nttps<T<U>>
{
static constexpr bool value = false;
};
template <template <typename, auto...> typename T, typename U, auto... N>
struct type_and_nttps<T<U, N...>>
{
static constexpr bool value = true;
};
template <typename TN>
struct test{};
template <typename T, int N>
struct vector{};
template <typename T, int R, int C>
struct matrix{};
static_assert(!type_and_nttps<float>::value);
static_assert(!type_and_nttps<test<float>>::value);
static_assert(type_and_nttps<vector<float, 3>>::value);
static_assert(type_and_nttps<matrix<float, 3, 3>>::value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment