summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/throw-expressions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGenCXX/throw-expressions.cpp')
-rw-r--r--clang/test/CodeGenCXX/throw-expressions.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/throw-expressions.cpp b/clang/test/CodeGenCXX/throw-expressions.cpp
index 7e81141d79c..549aef088c5 100644
--- a/clang/test/CodeGenCXX/throw-expressions.cpp
+++ b/clang/test/CodeGenCXX/throw-expressions.cpp
@@ -80,3 +80,35 @@ namespace DR1560 {
// CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN6DR15601AD1Ev {{.*}} @_ZGRN6DR15601rE
// CHECK-NOT: call {{.*}}@_ZN6DR15601AD1Ev
}
+
+// CHECK-LABEL: define void @_Z5test7b(
+void test7(bool cond) {
+ // CHECK: br i1
+ //
+ // x.true:
+ // CHECK: call void @__cxa_throw(
+ // CHECK-NEXT: unreachable
+ //
+ // x.false:
+ // CHECK: br label
+ //
+ // end:
+ // CHECK: ret void
+ cond ? throw test7 : val;
+}
+
+// CHECK-LABEL: define nonnull i32* @_Z5test8b(
+int &test8(bool cond) {
+ // CHECK: br i1
+ //
+ // x.true:
+ // CHECK: br label
+ //
+ // x.false:
+ // CHECK: call void @__cxa_throw(
+ // CHECK-NEXT: unreachable
+ //
+ // end:
+ // CHECK: ret i32* @val
+ return cond ? val : ((throw "foo"));
+}
OpenPOWER on IntegriCloud