libstdc++-v3/testsuite/20_util/unreachable/1.cc
raw| 1 | // { dg-do compile { target c++23 } } |
| 2 | // { dg-add-options no_pch } |
| 3 | |
| 4 | #include <utility> |
| 5 | |
| 6 | #ifndef __cpp_lib_unreachable |
| 7 | # error "Feature-test macro for unreachable missing in <utility>" |
| 8 | #elif __cpp_lib_unreachable != 202202L |
| 9 | # error "Feature-test macro for unreachable has wrong value in <utility>" |
| 10 | #endif |
| 11 | |
| 12 | bool test01(int i) |
| 13 | { |
| 14 | if (i == 4) |
| 15 | return true; |
| 16 | std::unreachable(); |
| 17 | } // { dg-bogus "control reaches end of non-void function" } |