1 // PR c++/78489 2 // { dg-do compile { target c++11 } } 3 4 template <bool Pred, class T> struct enable_if { typedef T type; }; 5 template <class T> struct enable_if<false, T> {}; 6 7 template <int Idx> struct blows_up { static_assert(Idx != Idx, ""); }; 8 9 template <int Idx, 10 // substitution should fail here 11 typename enable_if<Idx != Idx, int>::type = 0, 12 // GCC evaluates this statement 13 class = typename blows_up<Idx>::type 14 > 15 void Foo() {} 16 17 // Check the constructor in as SFINAE context 18 template <int I> constexpr auto test(int) -> decltype((Foo<I>(), true)) { return true; } 19 template <int> constexpr bool test(long) { return false; } 20 21 static_assert(!test<3>(0), ""); // Blows up 22