[clang] [clang] Diagnose dangling references for parenthesized aggregate initialization. (PR #117690)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 04:50:34 PST 2024


================
@@ -116,6 +116,7 @@ void foo(int n) { // expected-note {{declared here}}
   B b2(A(1), {}, 1);
   // beforecxx20-warning at -1 {{aggregate initialization of type 'A' from a parenthesized list of values is a C++20 extension}}
   // beforecxx20-warning at -2 {{aggregate initialization of type 'B' from a parenthesized list of values is a C++20 extension}}
+  // expected-warning at -3 {{temporary whose address is used as value of local variable 'b2' will be destroyed at the end of the full-expression}}
----------------
hokein wrote:

Done. Added one to the `cxx20-warn-dangling-paren-list-agg-init.cpp`.

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


More information about the cfe-commits mailing list