http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49225
Summary: [C++0x] Weird SFINAE behavior with variadic templates Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: paolo.carl...@oracle.com I cannot understand why the below compiles, that is why the constructor isn't disabled (whereas a static_assert in the body with the same expression would fire if uncommented). Thanks in advance for any clarification! ////////////////// template<typename _Tp, _Tp __v> struct integral_constant { static constexpr _Tp value = __v; typedef _Tp value_type; typedef integral_constant<_Tp, __v> type; constexpr operator value_type() { return value; } }; typedef integral_constant<bool, true> true_type; typedef integral_constant<bool, false> false_type; template<typename _Tp, _Tp __v> constexpr _Tp integral_constant<_Tp, __v>::value; template<bool, typename _Tp = void> struct enable_if { }; template<typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; }; template<typename, typename> struct is_same : public false_type { }; template<typename _Tp> struct is_same<_Tp, _Tp> : public true_type { }; // Just bits of <type_traits> so far... template<typename...> struct __my_and_; template<typename _B1> struct __my_and_<_B1> : public _B1 { }; template<typename... _Args1> struct Tt { template<typename... _Args2, typename = typename enable_if<__my_and_<is_same<_Args1, _Args2>...>::value>::type> Tt(_Args2...) { //static_assert(__my_and_<is_same<_Args1, _Args2>...>::value, "Error"); } }; struct A { }; A a; Tt<int> t(a); // The static_assert would trigger