1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s 2*f4a2713aSLionel Sambuc struct A { virtual void f(); }; 3*f4a2713aSLionel Sambuc struct B : A { }; 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc // CHECK: {{define.*@_Z1fP1A}} 6*f4a2713aSLionel Sambuc B fail; f(A * a)7*f4a2713aSLionel Sambucconst B& f(A *a) { 8*f4a2713aSLionel Sambuc try { 9*f4a2713aSLionel Sambuc // CHECK: call i8* @__dynamic_cast 10*f4a2713aSLionel Sambuc // CHECK: br i1 11*f4a2713aSLionel Sambuc // CHECK: invoke void @__cxa_bad_cast() [[NR:#[0-9]+]] 12*f4a2713aSLionel Sambuc dynamic_cast<const B&>(*a); 13*f4a2713aSLionel Sambuc } catch (...) { 14*f4a2713aSLionel Sambuc // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 15*f4a2713aSLionel Sambuc // CHECK-NEXT: catch i8* null 16*f4a2713aSLionel Sambuc } 17*f4a2713aSLionel Sambuc return fail; 18*f4a2713aSLionel Sambuc } 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc // CHECK: declare i8* @__dynamic_cast(i8*, i8*, i8*, i64) [[NUW_RO:#[0-9]+]] 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW_RO]] = { nounwind readonly } 23*f4a2713aSLionel Sambuc // CHECK: attributes [[NR]] = { noreturn } 24