summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-06-20 18:43:47 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-06-20 18:43:47 +0000
commitf3076ff2fd325d7ea74ced48f2e741baceef6460 (patch)
treece1f564f0326917fa13562b1e2c4c8c4326617a5 /clang/test
parent5c4a3d3118efaa97ea8b98954c4adee222f3fd41 (diff)
downloadbcm5719-llvm-f3076ff2fd325d7ea74ced48f2e741baceef6460.tar.gz
bcm5719-llvm-f3076ff2fd325d7ea74ced48f2e741baceef6460.zip
Don't crash when emitting a glvalue conditional where one arm is a
throw-expression. Based on a patch by Marius Wachtler! llvm-svn: 211388
Diffstat (limited to 'clang/test')
-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