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. 4 5 // RUN: %clangxx_cfi -o %t1 %s 6 // RUN: %run %t1 2>&1 | FileCheck --check-prefix=CFI %s 7 8 // CFI: In f1 9 // CFI: In f2 10 // CFI-NOT: control flow integrity check 11 12 // REQUIRES: cxxabi 13 14 #include <stdio.h> 15 16 class A1 { 17 public: 18 virtual void f1() = 0; 19 }; 20 21 class A2 { 22 public: 23 virtual void f2() = 0; 24 }; 25 26 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"); } 31 }; 32 33 int main() { 34 B b; 35 36 static_cast<A1*>(&b)->f1(); 37 static_cast<A2*>(&b)->f2(); 38 } 39