| 1 |
// REQUIRES: host-supports-jit |
| 2 |
// |
| 3 |
// This test is flaky with ASan: https://github.com/llvm/llvm-project/issues/135401 |
| 4 |
// UNSUPPORTED: asan |
| 5 |
// |
| 6 |
// We disable RTTI to avoid problems on Windows for non-RTTI builds of LLVM |
| 7 |
// where the JIT cannot find ??_7type_info@@6B@. |
| 8 |
// RUN: cat %s | clang-repl -Xcc -fno-rtti -Xcc -fno-sized-deallocation \ |
| 9 |
// RUN: | FileCheck %s |
| 10 |
// RUN: cat %s | clang-repl -Xcc -fno-rtti -Xcc -fno-sized-deallocation \ |
| 11 |
// RUN: -Xcc -O2 | FileCheck %s |
| 12 |
|
| 13 |
extern "C" int printf(const char *, ...); |
| 14 |
|
| 15 |
struct A { int a; A(int a) : a(a) {} virtual ~A(); }; |
| 16 |
|
| 17 |
// Then define the virtual destructor as inline out-of-line, in a separate |
| 18 |
// PartialTranslationUnit. |
| 19 |
inline A::~A() { printf("~A(%d)\n", a); } |
| 20 |
|
| 21 |
// Create one instance with new and delete it. We crash here now: |
| 22 |
A *a1 = new A(1); |
| 23 |
delete a1; |
| 24 |
// CHECK: ~A(1) |
| 25 |
|
| 26 |
// Also create one global that will be auto-destructed. |
| 27 |
A a2(2); |
| 28 |
// CHECK: ~A(2) |