mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-10 09:06:15 +01:00
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: ACKfa69a5f4b7
brunoerg: ACKfa69a5f4b7
marcofleon: ACKfa69a5f4b7
Tree-SHA512: 17604403f841343a6d5b6e5d777e1760d38e0c27dc1fd4479e3741894fba40cdb1fb659cf24519a51d051bd5884a75992d1227ec9fa40fbf53bc619fbfb304ad
This commit is contained in:
commit
b95adf057a
1 changed files with 2 additions and 2 deletions
|
@ -42,9 +42,9 @@ void assertion_fail(std::string_view file, int line, std::string_view func, std:
|
||||||
template <bool IS_ASSERT, typename T>
|
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)
|
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
|
#ifdef ABORT_ON_FAILED_ASSUME
|
||||||
|| true
|
|| true
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
if (!val) {
|
if (!val) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue