diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-07 21:53:22 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-07 21:53:22 +0000 |
commit | ea85232c4096cc7967cc8e79218d443402bf9be6 (patch) | |
tree | 0b0c74deeadc636a660410107cc447a344273626 /clang/test/CodeGenCXX/throw-expressions.cpp | |
parent | 78f05f13ad1289d0b005dfc4ca3a42c781b0712a (diff) | |
download | bcm5719-llvm-ea85232c4096cc7967cc8e79218d443402bf9be6.tar.gz bcm5719-llvm-ea85232c4096cc7967cc8e79218d443402bf9be6.zip |
Don't crash in IRGen if a conditional with 'throw' in one of its branches is
used as a branch condition.
llvm-svn: 181368
Diffstat (limited to 'clang/test/CodeGenCXX/throw-expressions.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/throw-expressions.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/throw-expressions.cpp b/clang/test/CodeGenCXX/throw-expressions.cpp index f04185b23f1..22d78410652 100644 --- a/clang/test/CodeGenCXX/throw-expressions.cpp +++ b/clang/test/CodeGenCXX/throw-expressions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -emit-llvm-only -verify %s -Wno-unreachable-code +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -Wno-unreachable-code -Werror -emit-llvm -o - %s | FileCheck %s // expected-no-diagnostics int val = 42; @@ -19,3 +19,28 @@ void test3() { int test4() { return 1 ? throw val : val; } + +// PR15923 +int test5(bool x, bool y, int z) { + return (x ? throw 1 : y) ? z : throw 2; +} +// CHECK: define i32 @_Z5test5bbi( +// CHECK: br i1 +// +// x.true: +// CHECK: call void @__cxa_throw( +// CHECK-NEXT: unreachable +// +// x.false: +// CHECK: br i1 +// +// y.true: +// CHECK: load i32* +// CHECK: br label +// +// y.false: +// CHECK: call void @__cxa_throw( +// CHECK-NEXT: unreachable +// +// end: +// CHECK: ret i32 |