Merge bitcoin/bitcoin#31150: util: Treat Assume as Assert when evaluating at compile-time

fa69a5f4b7 util: Treat Assume as Assert when evaluating at compile-time (MarcoFalke)

Pull request description:

  There is no downside or cost of treating an `Assume` at compile-time as an `Assert` and it may even help to find bugs while compiling without `ABORT_ON_FAILED_ASSUME`.

  This is also required for https://github.com/bitcoin/bitcoin/pull/31093

ACKs for top commit:
  dergoegge:
    ACK fa69a5f4b7
  brunoerg:
    ACK fa69a5f4b7
  marcofleon:
    ACK fa69a5f4b7

Tree-SHA512: 17604403f841343a6d5b6e5d777e1760d38e0c27dc1fd4479e3741894fba40cdb1fb659cf24519a51d051bd5884a75992d1227ec9fa40fbf53bc619fbfb304ad
pull/31093/head
merge-script 2 weeks ago
commit b95adf057a
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

@ -42,7 +42,7 @@ void assertion_fail(std::string_view file, int line, std::string_view func, std:
template <bool IS_ASSERT, typename T>
constexpr T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* file, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* assertion)
{
if constexpr (IS_ASSERT
if (IS_ASSERT || std::is_constant_evaluated()
#ifdef ABORT_ON_FAILED_ASSUME
|| true
#endif

Loading…
Cancel
Save