I'm trying to understand why I'm getting different behavior with 2 templates that should be equivalent to me
Given
template<template<typename...> class TT, typename T1, typename T2>
class A {};
is_a
is the generic version
template<typename T>
struct is_a : std::false_type
{
};
template<template<typename...> class TT, typename... T>
struct is_a<A<TT, T...>> : std::true_type
{
};
is_a2
is the version which has been manually expanded to 2 types instead of a paramter pack
template<typename T>
struct is_a2 : std::false_type
{
};
template<template<typename...> class TT, typename T1, typename T2>
struct is_a2<A<TT, T1, T2>> : std::true_type
{
};
I would expect the 2 versions to behave identically when A is instantiated with 3 parameters, but this is not the case
See the code compiling https://wandbox.org/permlink/MjSwFLvWmH0n1QLk
I would expect is_a
to work anywhere is_a2
works.
Is this a compiler bug I should report?
EDIT
Apparently this works in clang https://wandbox.org/permlink/9n5pXUGtBa8cAvFw
template<template<typename...> class TT, typename... T> A {};
. – Villus