File tree Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Expand file tree Collapse file tree 1 file changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -285,8 +285,7 @@ constexpr auto for_each(auto&& fn);
285
285
```cpp
286
286
/**
287
287
* Asserts that condition is satisfied
288
- * - constant evaluation: calls undefined function `failed()`
289
- * - run-time evaluation: #ifndef NDEBUG calls `breakpoint()` otherwise empty call
288
+ * - #ifndef NDEBUG calls `breakpoint()` (which is not constexpr) otherwise empty call
290
289
*/
291
290
constexpr void expect(auto cond) requires requires { bool(cond); };
292
291
```
@@ -469,7 +468,6 @@ template<class T> struct meta {
469
468
static constexpr auto id = mp::info{gen()};
470
469
constexpr auto friend get(info<id>) { return meta{}; }
471
470
};
472
- void failed();
473
471
} // namespace detail
474
472
475
473
/**
@@ -598,25 +596,18 @@ constexpr auto for_each(auto&& fn) {
598
596
599
597
/**
600
598
* Asserts that condition is satisfied
601
- * - constant evaluation: calls undefined function `failed()`
602
- * - run-time evaluation: #ifndef NDEBUG calls `breakpoint()` otherwise empty call
599
+ * - #ifndef NDEBUG calls `breakpoint()` (which is not constexpr) otherwise empty call
603
600
*/
604
601
constexpr void expect(auto cond) requires requires { bool(cond); } {
605
- if (__builtin_is_constant_evaluated()) {
602
+ #ifndef NDEBUG
606
603
if (not cond) {
607
- detail::failed();
604
+ #if defined (_MSC_VER)
605
+ __debugbreak();
606
+ #else
607
+ __builtin_trap();
608
+ #endif
608
609
}
609
- } else {
610
- #ifndef NDEBUG
611
- if (not cond) {
612
- #if defined (_MSC_VER)
613
- __debugbreak();
614
- #else
615
- __builtin_trap();
616
- #endif
617
- }
618
- #endif
619
- }
610
+ #endif
620
611
}
621
612
} // namespace mp
622
613
You can’t perform that action at this time.
0 commit comments