blob: 09deac1437245d0e14b1cc29a9c492753191cdfb [file] [log] [blame]
// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// REQUIRES: cxxabi
struct S { virtual int f() { return 0; } };
struct T : virtual S {};
struct Foo { virtual int f() { return 0; } };
int main(int argc, char **argv) {
Foo foo;
T *t = (T*)&foo;
S *s = t;
// CHECK: vptr-virtual-base.cpp:[[@LINE-1]]:10: runtime error: cast to virtual base of address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
// CHECK-NEXT: [[PTR]]: note: object is of type 'Foo'
return s->f();
}