================
@@ -108,7 +108,33 @@ constexpr bool test() {
auto prvalue_proj = [](const CheckDoubleMove& x) -> CheckDoubleMove {
return x; };
assert(&std::ranges::clamp(val, low, high, moving_comp, prvalue_proj) ==
&val);
}
+ { // Make sure we don't call the projection more than three times per
[alg.clamp], see #64717
+ int counter = 0;
+ auto projection_function = [counter](const int value) -> int {
+ assert(counter++ != 3);
----------------
ldionne wrote:
I would just do `++counter` here, no assertion. And then I would check after
calling `std::ranges::clamp` that `assert(counter == 3)`.
https://github.com/llvm/llvm-project/pull/66315
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits