Skip to content

Commit cf1a24b

Browse files
committed
test: add tests for LWG-4031
Signed-off-by: Yuming He <ComixHe1895@outlook.com>
1 parent bd6be76 commit cf1a24b

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

tests/test_expected/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(SOURCES
66
noexcept_tests.cpp
77
equality_tests.cpp
88
lwg_3886_tests.cpp
9+
lwg_4031_tests.cpp
910
)
1011

1112
find_package(Catch2 3 REQUIRED)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <catch2/catch_all.hpp>
2+
3+
#include <zeus/expected.hpp>
4+
5+
using namespace zeus;
6+
7+
namespace
8+
{
9+
// Exposing all members for testing
10+
struct test_bad_expected_access : public bad_expected_access<void>
11+
{
12+
using bad_expected_access<void>::bad_expected_access;
13+
};
14+
}
15+
16+
TEST_CASE("bad_expected_access<void> special members are noexcept", "[LWG-4031]")
17+
{
18+
STATIC_REQUIRE(std::is_nothrow_default_constructible_v<test_bad_expected_access>);
19+
STATIC_REQUIRE(std::is_nothrow_copy_constructible_v<test_bad_expected_access>);
20+
STATIC_REQUIRE(std::is_nothrow_move_constructible_v<test_bad_expected_access>);
21+
STATIC_REQUIRE(std::is_nothrow_copy_assignable_v<test_bad_expected_access>);
22+
STATIC_REQUIRE(std::is_nothrow_move_assignable_v<test_bad_expected_access>);
23+
STATIC_REQUIRE(std::is_nothrow_destructible_v<test_bad_expected_access>);
24+
}

0 commit comments

Comments
 (0)