================ @@ -37,9 +37,10 @@ struct __fn { _LIBCPP_ASSERT_UNCATEGORIZED(!bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))), "Bad bounds passed to std::ranges::clamp"); - if (std::invoke(__comp, std::invoke(__proj, __value), std::invoke(__proj, __low))) + auto&& __projected = std::invoke(__proj, __value); ---------------- timsong-cpp wrote:
This is always dangling no matter how you do it. This isn't `__proj(__something)`, it's `std::invoke(__proj, __something)`. No temporary is created for the call to `std::invoke` itself, that just binds a bunch of references. The full-expression with the temporary is somewhere inside the `std::invoke` machinery, and the temporary is destroyed by the time `std::invoke` returns. https://github.com/llvm/llvm-project/pull/68413 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits