blob: 9838e25b1d3f8c6b8436c66f98cfe02cd65db382 [file] [log] [blame]
Douglas Gregore37706d2010-05-14 21:50:50 +00001// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - | FileCheck %s
Anders Carlsson6f0e4852009-12-18 14:55:04 +00002struct A { virtual void f(); };
3struct B : A { };
4
Douglas Gregor485ee322010-05-14 21:14:41 +00005// CHECK: {{define.*@_Z1fP1A}}
6B fail;
Anders Carlsson6f0e4852009-12-18 14:55:04 +00007const B& f(A *a) {
Douglas Gregor485ee322010-05-14 21:14:41 +00008 try {
9 // CHECK: call i8* @__dynamic_cast
10 // CHECK: br i1
11 // CHECK: invoke void @__cxa_bad_cast() noreturn
Douglas Gregor69cfeb12010-05-14 21:31:02 +000012 dynamic_cast<const B&>(*a);
Douglas Gregore37706d2010-05-14 21:50:50 +000013 } catch (...) {
Douglas Gregor485ee322010-05-14 21:14:41 +000014 // CHECK: call i8* @llvm.eh.exception
Douglas Gregor485ee322010-05-14 21:14:41 +000015 }
16 return fail;
Anders Carlsson6f0e4852009-12-18 14:55:04 +000017}