Skip to content

Commit

Permalink
Work around internal compiler error in latest MSVC.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jan 27, 2024
1 parent 4d43d08 commit 499159f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion test/hash/sha/sha256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
14 changes: 12 additions & 2 deletions test/hash/sha/sha512.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 499159f

Please sign in to comment.