Skip to content

Commit b95adf0

Browse files
committed
Merge bitcoin/bitcoin#31150: util: Treat Assume as Assert when evaluating 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
2 parents 8f24e49 + fa69a5f commit b95adf0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/check.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ void assertion_fail(std::string_view file, int line, std::string_view func, std:
4242
template <bool IS_ASSERT, typename T>
4343
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)
4444
{
45-
if constexpr (IS_ASSERT
45+
if (IS_ASSERT || std::is_constant_evaluated()
4646
#ifdef ABORT_ON_FAILED_ASSUME
47-
|| true
47+
|| true
4848
#endif
4949
) {
5050
if (!val) {

0 commit comments

Comments
 (0)