Correctly classify T{} as an array temporary if T is an array of class type with nontrivial destructor.
llvm-svn: 174261
diff --git a/clang/test/SemaCXX/address-of-temporary.cpp b/clang/test/SemaCXX/address-of-temporary.cpp
index bb6cba3..5eef1c5 100644
--- a/clang/test/SemaCXX/address-of-temporary.cpp
+++ b/clang/test/SemaCXX/address-of-temporary.cpp
@@ -15,8 +15,13 @@
struct Y {
int a[4];
};
+ struct Z {
+ int n;
+ ~Z();
+ };
typedef int A[4];
+ typedef Z AZ[4];
template<typename T> void consume(T);
struct S { int *p; };
@@ -25,11 +30,13 @@
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 h0() { consume(Y().a); }
void h1() { consume(Y{}.a); }
void h2() { consume(A{}); }
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}}