================
@@ -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);
----------------
ldionne wrote:

I don't see how it could dangle. Do you mean that it will dangle if 
`std::invoke(__proj, __value)` returns a temporary? Rvalue references extend 
the lifetime of temporaries so whatever this references will live until the end 
of the function.

https://github.com/llvm/llvm-project/pull/66315
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to