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, c++17, c++20 10 11 // const char* what() const noexcept override; 12 13 #include <expected> 14 #include <cassert> 15 #include <utility> 16 17 #include "test_macros.h" 18 19 struct Foo {}; 20 21 int main(int, char**) { 22 { 23 std::bad_expected_access<int> const exc(99); 24 char const* what = exc.what(); 25 assert(what != nullptr); 26 ASSERT_NOEXCEPT(exc.what()); 27 } 28 { 29 std::bad_expected_access<Foo> const exc(Foo{}); 30 char const* what = exc.what(); 31 assert(what != nullptr); 32 ASSERT_NOEXCEPT(exc.what()); 33 } 34 35 return 0; 36 } 37