From 499159f4966a8c5ad28b3d3e778c4acd83c263fa Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sat, 27 Jan 2024 13:04:04 -0500 Subject: [PATCH] Work around internal compiler error in latest MSVC. --- test/hash/sha/sha256.cpp | 7 ++++++- test/hash/sha/sha512.cpp | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/hash/sha/sha256.cpp b/test/hash/sha/sha256.cpp index 781d95886e..86f21553f4 100644 --- a/test/hash/sha/sha256.cpp +++ b/test/hash/sha/sha256.cpp @@ -232,7 +232,12 @@ BOOST_AUTO_TEST_CASE(sha256__merkle_root__two__expected) { constexpr auto expected = sha256::double_hash({ 0 }, { 1 }); #if defined (HAVE_VECTOR_CONSTEXPR) - static_assert(sha256::merkle_root({ { 0 }, { 1 } }) == expected); + + // MSVC Debug build internal compiler error. + #if !(defined(HAVE_MSC) && !defined(NDEBUG)) + static_assert(sha256::merkle_root({ { 0 }, { 1 } }) == expected); + #endif + #endif BOOST_CHECK_EQUAL(sha256::merkle_root({ { 0 }, { 1 } }), expected); } diff --git a/test/hash/sha/sha512.cpp b/test/hash/sha/sha512.cpp index 16b368a6b5..5956291e94 100644 --- a/test/hash/sha/sha512.cpp +++ b/test/hash/sha/sha512.cpp @@ -232,7 +232,12 @@ BOOST_AUTO_TEST_CASE(sha512__merkle_root__two__expected) { constexpr auto expected = sha512::double_hash({ 0 }, { 1 }); #if defined (HAVE_VECTOR_CONSTEXPR) - static_assert(sha512::merkle_root({ { 0 }, { 1 } }) == expected); + + // MSVC Debug build internal compiler error. + #if !(defined(HAVE_MSC) && !defined(NDEBUG)) + static_assert(sha512::merkle_root({ { 0 }, { 1 } }) == expected); + #endif + #endif BOOST_CHECK_EQUAL(sha512::merkle_root({ { 0 }, { 1 } }), expected); } @@ -254,7 +259,12 @@ BOOST_AUTO_TEST_CASE(sha512__merkle_root__four__expected) constexpr auto expected2 = sha512::double_hash({ 2 }, { 3 }); constexpr auto expected = sha512::double_hash(expected1, expected2); #if defined (HAVE_VECTOR_CONSTEXPR) - static_assert(sha512::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }) == expected); + + // MSVC Debug build internal compiler error. + #if !(defined(HAVE_MSC) && !defined(NDEBUG)) + static_assert(sha512::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }) == expected); + #endif + #endif BOOST_CHECK_EQUAL(sha512::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }), expected); }