summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/condition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGenCXX/condition.cpp')
-rw-r--r--clang/test/CodeGenCXX/condition.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/condition.cpp b/clang/test/CodeGenCXX/condition.cpp
index f8a55d8716a..f3c8a9b7695 100644
--- a/clang/test/CodeGenCXX/condition.cpp
+++ b/clang/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;
+}
OpenPOWER on IntegriCloud