Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / variant / variant.bad_variant_access / bad_variant_access.pass.cpp
blobaa9c9251e6ff67662bafc0553d504a8e9b0b8d7c
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
10 // XFAIL: availability-bad_variant_access-missing
12 // <variant>
16 class bad_variant_access : public exception {
17 public:
18 bad_variant_access() noexcept;
19 virtual const char* what() const noexcept;
24 #include <cassert>
25 #include <exception>
26 #include <type_traits>
27 #include <variant>
29 #include "test_macros.h"
31 int main(int, char**) {
32 static_assert(std::is_base_of<std::exception, std::bad_variant_access>::value,
33 "");
34 static_assert(noexcept(std::bad_variant_access{}), "must be noexcept");
35 static_assert(noexcept(std::bad_variant_access{}.what()), "must be noexcept");
36 std::bad_variant_access ex;
37 assert(ex.what());
39 return 0;