diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-11-24 17:07:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-11-24 17:07:59 +0000 |
commit | d3d5301c44138b92bf01286183f5bf310cdd37cf (patch) | |
tree | 5e426515a870ee432cb704304b79058d3b042a24 /test/CodeGenCXX/condition.cpp | |
parent | c102297fb2857ef1af191a8e85e842cc3ac3239e (diff) |
Explicitly store the condition variable within switch statements, and
make sure that this variable is destroyed when we exit the switch
statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/condition.cpp')
-rw-r--r-- | test/CodeGenCXX/condition.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/CodeGenCXX/condition.cpp b/test/CodeGenCXX/condition.cpp index f8a55d8716..f3c8a9b769 100644 --- a/test/CodeGenCXX/condition.cpp +++ b/test/CodeGenCXX/condition.cpp @@ -45,3 +45,27 @@ void if_destruct(int z) { // CHECK: if.end // CHECK: call void @_ZN1XD1Ev } + +struct ConvertibleToInt { + ConvertibleToInt(); + ~ConvertibleToInt(); + operator int(); +}; + +void switch_destruct(int z) { + // CHECK: call void @_ZN16ConvertibleToIntC1Ev + switch (ConvertibleToInt conv = ConvertibleToInt()) { + case 0: + break; + + default: + // CHECK: sw.default: + // CHECK: store i32 19 + z = 19; + break; + } + // CHECK: sw.epilog: + // CHECK: call void @_ZN16ConvertibleToIntD1Ev + // CHECK: store i32 20 + z = 20; +} |