Warn if a local variable's initializer retains a pointer/reference to a
non-lifetime-extended temporary object.

llvm-svn: 337790
diff --git a/clang/test/SemaCXX/address-of-temporary.cpp b/clang/test/SemaCXX/address-of-temporary.cpp
index 5eef1c5..eb0ca3c 100644
--- a/clang/test/SemaCXX/address-of-temporary.cpp
+++ b/clang/test/SemaCXX/address-of-temporary.cpp
@@ -26,11 +26,12 @@
   template<typename T> void consume(T);
   struct S { int *p; };
 
-  void g0() { int *p = Y().a; } // expected-warning{{pointer is initialized by a temporary array}}
-  void g1() { int *p = Y{}.a; } // expected-warning{{pointer is initialized by a temporary array}}
-  void g2() { int *p = A{}; } // expected-warning{{pointer is initialized by a temporary array}}
-  void g3() { int *p = (A){}; } // expected-warning{{pointer is initialized by a temporary array}}
-  void g4() { Z *p = AZ{}; } // expected-warning{{pointer is initialized by a temporary array}}
+  void g0() { int *p = Y().a; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void g1() { int *p = Y{}.a; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void g2() { int *p = A{}; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void g3() { int *p = (A){}; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void g4() { Z *p = AZ{}; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void g5() { Z *p = &(Z&)(AZ{}[0]); } // expected-warning{{will be destroyed at the end of the full-expression}}
 
   void h0() { consume(Y().a); }
   void h1() { consume(Y{}.a); }
@@ -38,10 +39,10 @@
   void h3() { consume((A){}); }
   void h4() { consume(AZ{}); }
 
-  void i0() { S s = { Y().a }; } // expected-warning{{pointer is initialized by a temporary array}}
-  void i1() { S s = { Y{}.a }; } // expected-warning{{pointer is initialized by a temporary array}}
-  void i2() { S s = { A{} }; } // expected-warning{{pointer is initialized by a temporary array}}
-  void i3() { S s = { (A){} }; } // expected-warning{{pointer is initialized by a temporary array}}
+  void i0() { S s = { Y().a }; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void i1() { S s = { Y{}.a }; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void i2() { S s = { A{} }; } // expected-warning{{will be destroyed at the end of the full-expression}}
+  void i3() { S s = { (A){} }; } // expected-warning{{will be destroyed at the end of the full-expression}}
 
   void j0() { (void)S { Y().a }; }
   void j1() { (void)S { Y{}.a }; }