From 3f1c9ccd6e59581574ccdf5e7a45cf2524497378 Mon Sep 17 00:00:00 2001 From: Martin Moene Date: Tue, 10 Dec 2024 15:01:30 +0100 Subject: [PATCH] Silence Visual C++ warning 'discarded return value' (#74) expected.t.cpp(1347): warning C4834: discarding return value of function with 'nodiscard' attribute --- test/expected.t.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/expected.t.cpp b/test/expected.t.cpp index ac979d0..1038112 100644 --- a/test/expected.t.cpp +++ b/test/expected.t.cpp @@ -1344,7 +1344,7 @@ CASE( "expected: Allows to map unexpected with or_else" " [monadic p2505r3]" ) } const auto fallback_throw = []( int ) -> expected { throw std::runtime_error( "or_else" ); }; - EXPECT_THROWS_AS( (expected{ unexpect, 42 }).or_else( fallback_throw ), std::runtime_error ); + EXPECT_THROWS_AS( (void)(expected{ unexpect, 42 }).or_else( fallback_throw ), std::runtime_error ); const auto moveonly_fallback_to_66 = [](int) -> expected { return MoveOnly{ 66 }; }; EXPECT( (expected{ MoveOnly{ 33 } }).or_else( moveonly_fallback_to_66 ).value() == 33 );