I successfully compile the SSCCE code snippet below in Clang 8.0.0, MSVC v19.20 and GCC 8.3. Both MSVC and Clang will make the program return 0 and GCC causes the program to return 1 (godbolt), so there is a difference and I don't know which compiler produces the correct output.
#include <type_traits>
template<typename T>
struct Foo {
template <typename U>
using inner = Foo<U>;
};
template<template<typename ...Ts> typename>
struct is_foo_template : std::false_type {};
template<>
struct is_foo_template<Foo> : std::true_type {};
template<typename T>
struct is_foo : is_foo_template<T::template inner> {};
int main() {
return is_foo<Foo<int>>::value;
}
I think that this snippet returns is_foo<Foo<Int>>::value
, but the value is either std::true_type::value
or std::false_type::value
depending on if the Foo-specialization of is_foo_template
is selected or not. But the value returned from main
is not the same for all three compilers mentioned above, so it seems to me that not all compilers selects the same specialization.
Question(s): According to the standard, should the Foo-specialization be selected or should non-specialized template declaration be selected?