aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/20_util/expected/bad.cc
blob: 7e227f904a02f269ef6c64cbd9b1542d5d9f0236 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// { dg-do compile { target c++23 } }

#include <expected>

struct E {
  E() = default;
  E(E&&) = default;
};

void
test_pr105146()
{
  std::bad_expected_access(E{});
}

void
test_lwg4031()
{
  struct test_type : std::bad_expected_access<void> { };

  static_assert( std::is_nothrow_default_constructible_v<test_type> );
  // LWG 4031. bad_expected_access<void> member functions should be noexcept
  static_assert( std::is_nothrow_copy_constructible_v<test_type> );
  static_assert( std::is_nothrow_move_constructible_v<test_type> );
  static_assert( std::is_nothrow_copy_assignable_v<test_type> );
  static_assert( std::is_nothrow_move_assignable_v<test_type> );
}