[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / dynamic_cast-no-rtti.cpp
blob48f32fc3e89ba9b3ff15314bb43c7c1ab1f88ca9
1 // RUN: %clang_cc1 -emit-llvm %s -verify -fno-rtti -triple %itanium_abi_triple -o - | FileCheck %s
2 // expected-no-diagnostics
4 struct A {
5 virtual ~A(){};
6 };
8 struct B : public A {
9 B() : A() {}
12 // An upcast can be resolved statically and can be used with -fno-rtti, iff it
13 // does not use runtime support.
14 A *upcast(B *b) {
15 return dynamic_cast<A *>(b);
16 // CHECK-LABEL: define {{.*}}ptr @_Z6upcastP1B
17 // CHECK-NOT: call {{.*}}ptr @__dynamic_cast
20 // A NoOp dynamic_cast can be used with -fno-rtti iff it does not use
21 // runtime support.
22 B *samecast(B *b) {
23 return dynamic_cast<B *>(b);
24 // CHECK-LABEL: define {{.*}}ptr @_Z8samecastP1B
25 // CHECK-NOT: call {{.*}}ptr @__dynamic_cast