diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-19 12:27:56 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-19 12:27:56 +0000 |
commit | bac5cf4110c1c9ba0992fad4fd9f66cedc27f3da (patch) | |
tree | 40f34c5691894c76d9351d4e6a26289182ccfa66 /test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp | |
parent | 25e640a6e11f455b9c12aa5f724f7d50d9174c9c (diff) |
Add a testcase for using objects with list-constructors, and fix a Sema crash by repeating an old hack.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r-- | test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp b/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp index a1c4167261..79d2073759 100644 --- a/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -62,7 +62,10 @@ struct witharg1 { witharg1(const destroyme1&); ~witharg1(); }; - +struct wantslist1 { + wantslist1(std::initializer_list<destroyme1>); + ~wantslist1(); +}; void fn2() { // CHECK: define void @_Z3fn2v @@ -108,3 +111,28 @@ void fn5() { // CHECK: call void @_ZN10destroyme2D1Ev // CHECK: call void @_ZN8witharg1D1Ev } + +void fn6() { + // CHECK: define void @_Z3fn6v + void target(const wantslist1&); + // objects should be destroyed before dm2, after call returns + // CHECK: call void @_ZN10wantslist1C1ESt16initializer_listI10destroyme1E + // CHECK: call void @_Z6targetRK10wantslist1 + target({ destroyme1(), destroyme1() }); + // CHECK: call void @_ZN10wantslist1D1Ev + // CHECK: call void @_ZN10destroyme1D1Ev + destroyme2 dm2; + // CHECK: call void @_ZN10destroyme2D1Ev +} + +void fn7() { + // CHECK: define void @_Z3fn7v + // temps should be destroyed before dm2 + // object should be destroyed after dm2 + // CHECK: call void @_ZN10wantslist1C1ESt16initializer_listI10destroyme1E + wantslist1 wl = { destroyme1(), destroyme1() }; + // CHECK: call void @_ZN10destroyme1D1Ev + destroyme2 dm2; + // CHECK: call void @_ZN10destroyme2D1Ev + // CHECK: call void @_ZN10wantslist1D1Ev +} |