Skip to content

Commit

Permalink
Unguard copy- and move-assignment for std::unexpected with same error…
Browse files Browse the repository at this point in the history
… type (#66)
  • Loading branch information
martinmoene committed Jun 5, 2024
1 parent f2c80bf commit 2b45544
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions test/expected.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,30 +292,22 @@ CASE( "unexpected_type: Allows to move-construct from unexpected_type, non-expli

CASE( "unexpected_type: Allows to copy-assign from unexpected_type, default" )
{
#if !nsel_USES_STD_EXPECTED
unexpected_type<int> a{ 7 };
unexpected_type<int> a{ 7 };
unexpected_type<int> b{ 0 };

b = a;

EXPECT( b.error() == 7 );
#else
EXPECT( !!"no assignment for std::unexpected (C++23)." );
#endif
}

CASE( "unexpected_type: Allows to move-assign from unexpected_type, default" )
{
#if !nsel_USES_STD_EXPECTED
unexpected_type<int> a{ 7 };
unexpected_type<int> b{ 0 };

b = std::move( a );

EXPECT( b.error() == 7 );
#else
EXPECT( !!"no assignment for std::unexpected (C++23)." );
#endif
}

CASE( "unexpected_type: Allows to copy-assign from unexpected_type, converting" )
Expand Down Expand Up @@ -1007,7 +999,7 @@ CASE( "expected: Allows to emplace value" )

CASE( "expected: Allows to emplace value from initializer_list" )
{
expected<InitList, char> e{ {}, 'x'};
expected<InitList, char> e{ in_place, std::initializer_list<int>{}, 'x'};

auto ve = e.emplace( { 7, 8, 9 }, 'a' );

Expand Down

0 comments on commit 2b45544

Please sign in to comment.