From 884e021b9ad5463bad18310627a45201e3da0695 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 1 Mar 2023 23:00:02 +0100 Subject: [PATCH] Fix building with MSVC --- src/util/util.h | 4 ++-- tests/t00056/test_case.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/util/util.h b/src/util/util.h index 8b1c7433..15c12335 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -248,7 +248,7 @@ void apply_if_not_null(const T *pointer, F &&func, FElse &&func_else) if (pointer != nullptr) { std::forward(func)(pointer); } - else if (func_else) { + else { std::forward(func_else)(); } } @@ -265,7 +265,7 @@ void apply_if(const bool condition, F &&func, FElse &&func_else) if (condition) { std::forward(func)(); } - else if (func_else) { + else { std::forward(func_else)(); } } diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index a708ebb3..a1cce9f9 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -53,8 +53,14 @@ TEST_CASE("t00056", "[test-case][class]") REQUIRE_THAT( puml, IsConceptRequirement(_A("iterable"), "container.end()")); +#ifdef _MSC_VER + REQUIRE_THAT(puml, + IsConceptRequirement( + _A("convertible_to_string"), "std::string({s})")); +#else REQUIRE_THAT(puml, IsConceptRequirement(_A("convertible_to_string"), "std::string{s}")); +#endif REQUIRE_THAT(puml, IsConceptRequirement( _A("convertible_to_string"), "{std::to_string(s)} noexcept"));