diff options
Diffstat (limited to 'test/CodeGenCXX/dynamic-cast.cpp')
-rw-r--r-- | test/CodeGenCXX/dynamic-cast.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/test/CodeGenCXX/dynamic-cast.cpp b/test/CodeGenCXX/dynamic-cast.cpp index aeb2a64..9838e25 100644 --- a/test/CodeGenCXX/dynamic-cast.cpp +++ b/test/CodeGenCXX/dynamic-cast.cpp @@ -1,8 +1,17 @@ -// RUN: %clang_cc1 %s -emit-llvm-only - +// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - | FileCheck %s struct A { virtual void f(); }; struct B : A { }; +// CHECK: {{define.*@_Z1fP1A}} +B fail; const B& f(A *a) { - return dynamic_cast<const B&>(*a); + try { + // CHECK: call i8* @__dynamic_cast + // CHECK: br i1 + // CHECK: invoke void @__cxa_bad_cast() noreturn + dynamic_cast<const B&>(*a); + } catch (...) { + // CHECK: call i8* @llvm.eh.exception + } + return fail; } |