1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 // UNSUPPORTED: c++98, c++03, c++11, c++14
12 
13 // XFAIL: availability=macosx10.13
14 // XFAIL: availability=macosx10.12
15 // XFAIL: availability=macosx10.11
16 // XFAIL: availability=macosx10.10
17 // XFAIL: availability=macosx10.9
18 // XFAIL: availability=macosx10.8
19 // XFAIL: availability=macosx10.7
20 
21 
22 // <variant>
23 
24 /*
25 
26  class bad_variant_access : public exception {
27 public:
28   bad_variant_access() noexcept;
29   virtual const char* what() const noexcept;
30 };
31 
32 */
33 
34 #include <cassert>
35 #include <exception>
36 #include <type_traits>
37 #include <variant>
38 
main()39 int main() {
40   static_assert(std::is_base_of<std::exception, std::bad_variant_access>::value,
41                 "");
42   static_assert(noexcept(std::bad_variant_access{}), "must be noexcept");
43   static_assert(noexcept(std::bad_variant_access{}.what()), "must be noexcept");
44   std::bad_variant_access ex;
45   assert(ex.what());
46 }
47