1// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -fPIC -shared -o %dynamiclib -DBUILD_SO %ld_flags_rpath_so
2// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -O3 -o %t %ld_flags_rpath_exe
3// RUN: %run %t
4//
5// REQUIRES: cxxabi
6// FIXME: Should pass on Android, but started failing around 2023-11-05 for unknown reasons.
7// UNSUPPORTED: target={{.*(windows|android).*}}
8
9struct X {
10 virtual ~X() {}
11};
12X *libCall();
13
14#ifdef BUILD_SO
15
16X *libCall() {
17 return new X;
18}
19
20#else
21
22int main() {
23 X *px = libCall();
24 delete px;
25}
26
27#endif
28

source code of compiler-rt/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp