1 // PR c++/78489 2 // { dg-do compile { target c++11 } } 3 4 template <bool P, class T = void> struct enable_if { using type = T; }; 5 template <class T> struct enable_if<false, T> {}; 6 7 template <class Dummy> struct use_type { using type = int; }; 8 9 template <bool Pred> 10 struct get_type { 11 static_assert(Pred, ""); 12 using type = int; 13 }; 14 15 template <bool Val, 16 class = typename enable_if<Val>::type, // Evaluation/Substitution should end here 17 class ValT = typename get_type<Val>::type, // This should not be instantiated 18 typename use_type<ValT>::type = 0 // This NTTP causes ValT to be required 19 > 20 constexpr bool test(int) { return false; } 21 22 template <bool> 23 constexpr bool test(long) { return true; } 24 25 static_assert(test<false>(0), ""); // should call test(long) 26