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
10 
11 // <variant>
12 
13 /*
14 
15  class bad_variant_access : public exception {
16 public:
17   bad_variant_access() noexcept;
18   virtual const char* what() const noexcept;
19 };
20 
21 */
22 
23 #include <cassert>
24 #include <exception>
25 #include <type_traits>
26 #include <variant>
27 
28 #include "test_macros.h"
29 
main(int,char **)30 int main(int, char**) {
31   static_assert(std::is_base_of<std::exception, std::bad_variant_access>::value,
32                 "");
33   static_assert(noexcept(std::bad_variant_access{}), "must be noexcept");
34   static_assert(noexcept(std::bad_variant_access{}.what()), "must be noexcept");
35   std::bad_variant_access ex;
36   assert(ex.what());
37 
38   return 0;
39 }
40