================
@@ -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:
The `invoke(__proj, __value)` call itself creates no temporaries; it just binds
two references. Any temporaries are created inside `invoke` and are destroyed
before `invoke` returns, so `invoke(identity_proj, "")` is always dangling
regardless of what you do with the result.
https://github.com/llvm/llvm-project/pull/66315
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits