| 1 |
// { dg-do compile { target c++23 } } |
| 2 |
|
| 3 |
#include <expected> |
| 4 |
|
| 5 |
struct E { |
| 6 |
E() = default; |
| 7 |
E(E&&) = default; |
| 8 |
}; |
| 9 |
|
| 10 |
void |
| 11 |
test_pr105146() |
| 12 |
{ |
| 13 |
std::bad_expected_access(E{}); |
| 14 |
} |
| 15 |
|
| 16 |
void |
| 17 |
test_lwg4031() |
| 18 |
{ |
| 19 |
struct test_type : std::bad_expected_access<void> { }; |
| 20 |
|
| 21 |
static_assert( std::is_nothrow_default_constructible_v<test_type> ); |
| 22 |
// LWG 4031. bad_expected_access<void> member functions should be noexcept |
| 23 |
static_assert( std::is_nothrow_copy_constructible_v<test_type> ); |
| 24 |
static_assert( std::is_nothrow_move_constructible_v<test_type> ); |
| 25 |
static_assert( std::is_nothrow_copy_assignable_v<test_type> ); |
| 26 |
static_assert( std::is_nothrow_move_assignable_v<test_type> ); |
| 27 |
} |