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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 07:00:09 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">;
----------------
erichkeane wrote:

```suggestion
  warn_ret_local_temp_addr_ref.Text>;
```

(or something like that?  Either way, the messages are intentionally the same, would be nice to just share the text).

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


More information about the cfe-commits mailing list