Douglas Gregor | e37706d | 2010-05-14 21:50:50 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - | FileCheck %s |
Anders Carlsson | 6f0e485 | 2009-12-18 14:55:04 +0000 | [diff] [blame] | 2 | struct A { virtual void f(); }; |
| 3 | struct B : A { }; |
| 4 | |
Douglas Gregor | 485ee32 | 2010-05-14 21:14:41 +0000 | [diff] [blame] | 5 | // CHECK: {{define.*@_Z1fP1A}} |
| 6 | B fail; |
Anders Carlsson | 6f0e485 | 2009-12-18 14:55:04 +0000 | [diff] [blame] | 7 | const B& f(A *a) { |
Douglas Gregor | 485ee32 | 2010-05-14 21:14:41 +0000 | [diff] [blame] | 8 | try { |
| 9 | // CHECK: call i8* @__dynamic_cast |
| 10 | // CHECK: br i1 |
| 11 | // CHECK: invoke void @__cxa_bad_cast() noreturn |
Douglas Gregor | 69cfeb1 | 2010-05-14 21:31:02 +0000 | [diff] [blame] | 12 | dynamic_cast<const B&>(*a); |
Douglas Gregor | e37706d | 2010-05-14 21:50:50 +0000 | [diff] [blame] | 13 | } catch (...) { |
Douglas Gregor | 485ee32 | 2010-05-14 21:14:41 +0000 | [diff] [blame] | 14 | // CHECK: call i8* @llvm.eh.exception |
Douglas Gregor | 485ee32 | 2010-05-14 21:14:41 +0000 | [diff] [blame] | 15 | } |
| 16 | return fail; |
Anders Carlsson | 6f0e485 | 2009-12-18 14:55:04 +0000 | [diff] [blame] | 17 | } |