From f0d9d4235511c14adace4cd70f2e49c6033495b4 Mon Sep 17 00:00:00 2001 From: Emily Dolson Date: Sun, 26 Nov 2023 01:49:24 -0500 Subject: [PATCH] Fix windows optional_throw --- include/emp/base/optional_throw.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/emp/base/optional_throw.hpp b/include/emp/base/optional_throw.hpp index 2666b20734..e1a6ef9b82 100644 --- a/include/emp/base/optional_throw.hpp +++ b/include/emp/base/optional_throw.hpp @@ -24,16 +24,18 @@ #if defined (_MSC_VER ) - #define emp_optional_throw(TEST, MESSAGE) \ + #define emp_optional_throw_mscv_impl(TEST, MESSAGE) \ do { \ if (!(TEST)) { \ emp::assert_throw(__FILE__, __LINE__, #TEST, #MESSAGE, 0); \ } \ } while(0) + #define emp_optional_throw_impl(TEST, MESSAGE) emp_optional_throw_mscv_impl(TEST, MESSAGE) + #else - #define emp_optional_throw(...) \ + #define emp_optional_throw_impl(...) \ do { \ if (!(emp_assert_GET_ARG_1(__VA_ARGS__, ~))) { \ emp::assert_throw( \ @@ -46,6 +48,8 @@ #endif + #define emp_optional_throw(...) emp_optional_throw_impl(__VA_ARGS__) + #elif defined( EMP_NDEBUG ) #define emp_optional_throw(...)