snitch-org / snitch

Lightweight C++20 testing framework.
Boost Software License 1.0
257 stars 7 forks source link

`REQUIRE_THROWS_*` macros with a direct `throw` statement generate MSVC warning #70

Closed cschreib closed 1 year ago

cschreib commented 1 year ago
REQUIRE_THROWS_AS(throw 1, int);

generates

warning C4702: unreachable code

inside the snitch macro implementation

cschreib commented 1 year ago

We can't fix that unless we globally disable C4702. Unfortunately, this warning must be disabled before the current function (test case) is declared; changing it inside the function (test case) has no effect.

snitch should not globally disable warnings. The solution to this problem is to have the user disable this warning explicitly.