gcc/testsuite/g++.dg/cpp0x/nontype5.C
raw| 1 | // PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17. |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | template<typename T> |
| 5 | constexpr bool is_integral_(...) { |
| 6 | return false; |
| 7 | } |
| 8 | template<typename T, T = 1> |
| 9 | constexpr bool is_integral_(long) { |
| 10 | return true; |
| 11 | } |
| 12 | |
| 13 | static_assert(is_integral_<int>(42), ""); |
| 14 | static_assert(!is_integral_<void>(42), ""); |
| 15 | |
| 16 | struct S {}; |
| 17 | static_assert(!is_integral_<S>(42), ""); |