Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Interpreter / inline-virtual.cpp
blob9c31208a4a642195587c38d5195cf8eed9dbdf31
1 // REQUIRES: host-supports-jit
2 // UNSUPPORTED: system-aix
3 //
4 // We disable RTTI to avoid problems on Windows for non-RTTI builds of LLVM
5 // where the JIT cannot find ??_7type_info@@6B@.
6 // RUN: cat %s | clang-repl -Xcc -fno-rtti -Xcc -fno-sized-deallocation \
7 // RUN: | FileCheck %s
8 // RUN: cat %s | clang-repl -Xcc -fno-rtti -Xcc -fno-sized-deallocation \
9 // RUN: -Xcc -O2 | FileCheck %s
11 extern "C" int printf(const char *, ...);
13 struct A { int a; A(int a) : a(a) {} virtual ~A(); };
15 // Then define the virtual destructor as inline out-of-line, in a separate
16 // PartialTranslationUnit.
17 inline A::~A() { printf("~A(%d)\n", a); }
19 // Create one instance with new and delete it. We crash here now:
20 A *a1 = new A(1);
21 delete a1;
22 // CHECK: ~A(1)
24 // Also create one global that will be auto-destructed.
25 A a2(2);
26 // CHECK: ~A(2)