summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/instantiate-expr-4.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-07-26 15:11:03 +0000
committerDouglas Gregor <dgregor@apple.com>2011-07-26 15:11:03 +0000
commit72912fb9a42ec1095c53c82cbac575d19a4b6c92 (patch)
tree5475b5557b086e424bffc5a57383533b015b9042 /clang/test/SemaTemplate/instantiate-expr-4.cpp
parent3ac1836540641ec69f739d8660b6d8540c521953 (diff)
downloadbcm5719-llvm-72912fb9a42ec1095c53c82cbac575d19a4b6c92.tar.gz
bcm5719-llvm-72912fb9a42ec1095c53c82cbac575d19a4b6c92.zip
When we decide not to rebuild an instantiated C++ 'new' expression
that allocates an array of objects with a non-trivial destructor, be sure to mark the destructor is "used". Fixes PR10480 / <rdar://problem/9834317>. llvm-svn: 136081
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-expr-4.cpp')
-rw-r--r--clang/test/SemaTemplate/instantiate-expr-4.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-expr-4.cpp b/clang/test/SemaTemplate/instantiate-expr-4.cpp
index 521d2180d7a..9483f9b2836 100644
--- a/clang/test/SemaTemplate/instantiate-expr-4.cpp
+++ b/clang/test/SemaTemplate/instantiate-expr-4.cpp
@@ -135,6 +135,23 @@ namespace PR5755 {
}
}
+namespace PR10480 {
+ template<typename T>
+ struct X {
+ X();
+ ~X() {
+ T *ptr = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
+ }
+ };
+
+ template<typename T>
+ void f() {
+ new X<int>[1]; // expected-note{{in instantiation of member function 'PR10480::X<int>::~X' requested here}}
+ }
+
+ template void f<int>();
+}
+
// ---------------------------------------------------------------------
// throw expressions
// ---------------------------------------------------------------------
OpenPOWER on IntegriCloud