[clang] [Clang] Implement C++26 P2748R5 "Disallow Binding a Returned Glvalue to a Temporary" (PR #89942)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 08:35:26 PDT 2024


================
@@ -9950,6 +9950,8 @@ def warn_ret_stack_addr_ref : Warning<
 def warn_ret_local_temp_addr_ref : Warning<
   "returning %select{address of|reference to}0 local temporary object">,
   InGroup<ReturnStackAddress>;
+def err_ret_local_temp_addr_ref : Error<
+  "returning %select{address of|reference to}0 local temporary object">;
----------------
yronglin wrote:

Agree!

https://github.com/llvm/llvm-project/pull/89942


More information about the cfe-commits mailing list