Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / cfi / multiple-inheritance2.cpp
blobf6b38452ee7279c1361e4d843783bcfe757dc60c
1 // Test that virtual functions of the derived class can be called through
2 // pointers of both base classes without CFI errors.
3 // Related to Bugzilla 43390.
5 // RUN: %clangxx_cfi -o %t1 %s
6 // RUN: %run %t1 2>&1 | FileCheck --check-prefix=CFI %s
8 // CFI: In f1
9 // CFI: In f2
10 // CFI-NOT: control flow integrity check
12 // REQUIRES: cxxabi
14 #include <stdio.h>
16 class A1 {
17 public:
18 virtual void f1() = 0;
21 class A2 {
22 public:
23 virtual void f2() = 0;
27 class B : public A1, public A2 {
28 public:
29 void f2() final { fprintf(stderr, "In f2\n"); }
30 void f1() final { fprintf(stderr, "In f1\n"); }
33 int main() {
34 B b;
36 static_cast<A1*>(&b)->f1();
37 static_cast<A2*>(&b)->f2();