diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-02 01:13:06 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-02 01:13:06 +0000 |
commit | 802e22682c17c4a9df3f747abd224db38e382e39 (patch) | |
tree | 4623c1c26979216f480a54a02eb8ae04ac823abf /test/CodeGenCXX/cxx0x-initializer-array.cpp | |
parent | 975f253bb31f665171517d43de6686e56507abac (diff) |
Don't forget to run destructors when we create an array temporary of class type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cxx0x-initializer-array.cpp')
-rw-r--r-- | test/CodeGenCXX/cxx0x-initializer-array.cpp | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/test/CodeGenCXX/cxx0x-initializer-array.cpp b/test/CodeGenCXX/cxx0x-initializer-array.cpp index 5e81ba1ff9..73bbca13b1 100644 --- a/test/CodeGenCXX/cxx0x-initializer-array.cpp +++ b/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 + } +} |