brintos

brintos / llvm-project-archived public Read only

0
0
Text · 696 B · f6b3845 Raw
39 lines · cpp
1// Test that virtual functions of the derived class can be called through2// pointers of both base classes without CFI errors.3// Related to Bugzilla 43390.4 5// RUN: %clangxx_cfi -o %t1 %s6// RUN: %run %t1 2>&1 | FileCheck --check-prefix=CFI %s7 8// CFI: In f19// CFI: In f210// CFI-NOT: control flow integrity check11 12// REQUIRES: cxxabi13 14#include <stdio.h>15 16class A1 {17public:18    virtual void f1() = 0;19};20 21class A2 {22public:23    virtual void f2() = 0;24};25 26 27class B : public A1, public A2 {28public:29    void f2() final { fprintf(stderr, "In f2\n"); }30    void f1() final { fprintf(stderr, "In f1\n"); }31};32 33int main() {34    B b;35 36    static_cast<A1*>(&b)->f1();37    static_cast<A2*>(&b)->f2();38}39