blob: 48ec69226c293c9dbdbd230808c552e32c6f4309 [file] [log] [blame]
Anders Carlssonc1c99712011-04-11 01:45:29 +00001// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -std=c++0x -o - | FileCheck %s
2struct A { virtual ~A(); };
3struct B final : A { };
4struct C { virtual ~C(); };
5
6// CHECK: @_Z1fP1B
7C *f(B* b) {
8 // CHECK-NOT: call i8* @__dynamic_cast
9 // CHECK: ret %struct.C* null
10 return dynamic_cast<C*>(b);
11}
12
13// CHECK: @_Z1fR1B
14C &f(B& b) {
15 // CHECK-NOT: call i8* @__dynamic_cast
16 // CHECK: call void @__cxa_bad_cast() noreturn
17 // CHECK: ret %struct.C* undef
18 return dynamic_cast<C&>(b);
19}