diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-19 12:28:02 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-19 12:28:02 +0000 |
commit | 8eb351d72ed91035311a0aa05c3676841675a895 (patch) | |
tree | 0a393316f4c77726d70e39f3cfbb5cd43113faec /clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp | |
parent | 99f66164701ffdf5fea16e9db26553d0636ae329 (diff) | |
download | bcm5719-llvm-8eb351d72ed91035311a0aa05c3676841675a895.tar.gz bcm5719-llvm-8eb351d72ed91035311a0aa05c3676841675a895.zip |
Get recursive initializer lists to work and add a test. Codegen of std::initializer_list is now complete. Onward to array new.
llvm-svn: 150926
Diffstat (limited to 'clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp index 79d20737592..7dc5503c969 100644 --- a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -136,3 +136,31 @@ void fn7() { // CHECK: call void @_ZN10destroyme2D1Ev // CHECK: call void @_ZN10wantslist1D1Ev } + +void fn8() { + // CHECK: define void @_Z3fn8v + void target(std::initializer_list<std::initializer_list<destroyme1>>); + // objects should be destroyed before dm2, after call returns + // CHECK: call void @_Z6targetSt16initializer_listIS_I10destroyme1EE + std::initializer_list<destroyme1> inner; + target({ inner, { destroyme1() } }); + // CHECK: call void @_ZN10destroyme1D1Ev + // Only one destroy loop, since only one inner init list is directly inited. + // CHECK-NOT: call void @_ZN10destroyme1D1Ev + destroyme2 dm2; + // CHECK: call void @_ZN10destroyme2D1Ev +} + +void fn9() { + // CHECK: define void @_Z3fn9v + // objects should be destroyed after dm2 + std::initializer_list<destroyme1> inner; + std::initializer_list<std::initializer_list<destroyme1>> list = + { inner, { destroyme1() } }; + destroyme2 dm2; + // CHECK: call void @_ZN10destroyme2D1Ev + // CHECK: call void @_ZN10destroyme1D1Ev + // Only one destroy loop, since only one inner init list is directly inited. + // CHECK-NOT: call void @_ZN10destroyme1D1Ev + // CHECK: ret void +} |