Skip to content

Commit

Permalink
Merge bitcoin/bitcoin#31150: util: Treat Assume as Assert when evalua…
Browse files Browse the repository at this point in the history
…ting at compile-time

fa69a5f 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 bitcoin/bitcoin#31093

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

Tree-SHA512: 17604403f841343a6d5b6e5d777e1760d38e0c27dc1fd4479e3741894fba40cdb1fb659cf24519a51d051bd5884a75992d1227ec9fa40fbf53bc619fbfb304ad
  • Loading branch information
fanquake committed Oct 25, 2024
2 parents 8f24e49 + fa69a5f commit b95adf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ 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
|| true
#endif
) {
if (!val) {
Expand Down

0 comments on commit b95adf0

Please sign in to comment.