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 // <variant> 14 15 /* 16 17 class bad_variant_access : public exception { 18 public: 19 bad_variant_access() noexcept; 20 virtual const char* what() const noexcept; 21 }; 22 23 */ 24 25 #include <cassert> 26 #include <exception> 27 #include <type_traits> 28 #include <variant> 29 30 int main() { 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