summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/cxx0x-initializer-array.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-02-02 01:13:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-02-02 01:13:06 +0000
commitd712d0dbddcd97e979b813158fe42fc3a351e460 (patch)
tree6605ed5fb67df9e920c6ef5adeabfcff13d032ef /clang/test/CodeGenCXX/cxx0x-initializer-array.cpp
parentf5209c4b459d3fc21a6bdfff7534ee6a8762b11a (diff)
downloadbcm5719-llvm-d712d0dbddcd97e979b813158fe42fc3a351e460.tar.gz
bcm5719-llvm-d712d0dbddcd97e979b813158fe42fc3a351e460.zip
Don't forget to run destructors when we create an array temporary of class type.
llvm-svn: 174257
Diffstat (limited to 'clang/test/CodeGenCXX/cxx0x-initializer-array.cpp')
-rw-r--r--clang/test/CodeGenCXX/cxx0x-initializer-array.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/cxx0x-initializer-array.cpp b/clang/test/CodeGenCXX/cxx0x-initializer-array.cpp
index 5e81ba1ff9d..73bbca13b18 100644
--- a/clang/test/CodeGenCXX/cxx0x-initializer-array.cpp
+++ b/clang/test/CodeGenCXX/cxx0x-initializer-array.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -std=c++11 -S -emit-llvm -o - %s -Wno-address-of-temporary | FileCheck %s
// CHECK: @[[THREE_NULL_MEMPTRS:.*]] = private constant [3 x i32] [i32 -1, i32 -1, i32 -1]
@@ -48,3 +48,47 @@ namespace ValueInitArrayOfMemPtr {
f(a{});
}
}
+
+namespace array_dtor {
+ struct S { S(); ~S(); };
+ using T = S[3];
+ void f(const T &);
+ // CHECK: define void @_ZN10array_dtor1gEv(
+ void g() {
+ // CHECK: %[[ARRAY:.*]] = alloca [3 x
+ // CHECK: br
+
+ // Construct loop.
+ // CHECK: call void @_ZN10array_dtor1SC1Ev(
+ // CHECK: br i1
+
+ // CHECK: call void @_ZN10array_dtor1fERA3_KNS_1SE(
+ // CHECK: br
+
+ // Destruct loop.
+ // CHECK: call void @_ZN10array_dtor1SD1Ev(
+ // CHECK: br i1
+
+ // CHECK: ret void
+
+ f(T{});
+ }
+ // CHECK: define void @_ZN10array_dtor1hEv(
+ void h() {
+ // CHECK: %[[ARRAY:.*]] = alloca [3 x
+ // CHECK: br
+
+ // CHECK: call void @_ZN10array_dtor1SC1Ev(
+ // CHECK: br i1
+ T &&t = T{};
+
+ // CHECK: call void @_ZN10array_dtor1fERA3_KNS_1SE(
+ // CHECK: br
+ f(t);
+
+ // CHECK: call void @_ZN10array_dtor1SD1Ev(
+ // CHECK: br i1
+
+ // CHECK: ret void
+ }
+}
OpenPOWER on IntegriCloud