| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 |
| 10 | |
| 11 | // Make sure we can use `std::unreachable()`. We can't actually execute it cause that would be |
| 12 | // UB, but we can make sure that it doesn't cause a linker error or something like that. |
| 13 | |
| 14 | #include <cassert> |
| 15 | #include <type_traits> |
| 16 | #include <utility> |
| 17 | |
| 18 | int main(int argc, char**) { |
| 19 | assert(argc == 1); |
| 20 | if (argc != 1) { |
| 21 | std::unreachable(); |
| 22 | } |
| 23 | |
| 24 | static_assert(std::is_same_v<decltype(std::unreachable()), void>); |
| 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |