aboutsummaryrefslogtreecommitdiff
path: root/libcxx/test/std/utilities/utility/utility.unreachable/unreachable.pass.cpp
blob: 290c61f41c52063903c655b67141ecddb4e3e42c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// Make sure we can use `std::unreachable()`. We can't actually execute it cause that would be
// UB, but we can make sure that it doesn't cause a linker error or something like that.

#include <cassert>
#include <type_traits>
#include <utility>

int main(int argc, char**) {
    assert(argc == 1);
    if (argc != 1) {
        std::unreachable();
    }

    static_assert(std::is_same_v<decltype(std::unreachable()), void>);

    return 0;
}