aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-02-02 02:11:36 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-02-02 02:11:36 +0000
commit821b93eec8b58a3e320ef34e7c98906ab61cf8c3 (patch)
tree320c1d490db3cadc6e26d293885686e57058d19e /test
parent9d9f254f7781c157256dbde4d4d961a2d89e8599 (diff)
Correctly classify T{} as an array temporary if T is an array of class type with nontrivial destructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174261 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/SemaCXX/address-of-temporary.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/SemaCXX/address-of-temporary.cpp b/test/SemaCXX/address-of-temporary.cpp
index bb6cba3187..5eef1c5521 100644
--- a/test/SemaCXX/address-of-temporary.cpp
+++ b/test/SemaCXX/address-of-temporary.cpp
@@ -15,8 +15,13 @@ namespace PointerToArrayDecay {
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 @@ namespace PointerToArrayDecay {
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}}