Skip to content

Commit

Permalink
Silence Visual C++ warning 'discarded return value' (#74)
Browse files Browse the repository at this point in the history
expected.t.cpp(1347): warning C4834: discarding return value of function with 'nodiscard' attribute
  • Loading branch information
martinmoene committed Dec 10, 2024
1 parent d426ef2 commit 3f1c9cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/expected.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ CASE( "expected: Allows to map unexpected with or_else" " [monadic p2505r3]" )
}

const auto fallback_throw = []( int ) -> expected<int, int> { throw std::runtime_error( "or_else" ); };
EXPECT_THROWS_AS( (expected<int, int>{ unexpect, 42 }).or_else( fallback_throw ), std::runtime_error );
EXPECT_THROWS_AS( (void)(expected<int, int>{ unexpect, 42 }).or_else( fallback_throw ), std::runtime_error );

const auto moveonly_fallback_to_66 = [](int) -> expected<MoveOnly, int> { return MoveOnly{ 66 }; };
EXPECT( (expected<MoveOnly, int>{ MoveOnly{ 33 } }).or_else( moveonly_fallback_to_66 ).value() == 33 );
Expand Down

0 comments on commit 3f1c9cc

Please sign in to comment.