diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
| commit | 9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch) | |
| tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /test/CodeGenCXX/throw-expressions.cpp | |
| parent | f73d5f23a889b93d89ddef61ac0995df40286bb8 (diff) | |
Notes
Diffstat (limited to 'test/CodeGenCXX/throw-expressions.cpp')
| -rw-r--r-- | test/CodeGenCXX/throw-expressions.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/CodeGenCXX/throw-expressions.cpp b/test/CodeGenCXX/throw-expressions.cpp index d9bf8fdd59ea..4dd5322fba51 100644 --- a/test/CodeGenCXX/throw-expressions.cpp +++ b/test/CodeGenCXX/throw-expressions.cpp @@ -67,3 +67,48 @@ int test6(bool x, bool y, int z) { // // end: // CHECK: ret i32 + +namespace DR1560 { + struct A { + ~A(); + }; + extern bool b; + A get(); + // CHECK-LABEL: @_ZN6DR15601bE + const A &r = b ? get() : throw 0; + // CHECK-NOT: call {{.*}}@_ZN6DR15601AD1Ev + // 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 dereferenceable(4) 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")); +} |
