26 lines · cpp
1// RUN: %clangxx_cfi -o %t %s2// RUN: %run %t3 4// In this example, both __typeid_A_global_addr and __typeid_B_global_addr will5// refer to the same address. Make sure that the compiler does not assume that6// they do not alias.7 8struct A {9 virtual void f() = 0;10};11 12struct B : A {13 virtual void f() {}14};15 16__attribute__((weak)) void foo(void *p) {17 B *b = (B *)p;18 A *a = (A *)b;19 a->f();20}21 22int main() {23 B b;24 foo(&b);25}26