cling/test/CodeGeneration/VTableDestructor.C
Jonas Hahnfeld b721467e15 Fix emission of vtables
It is (again) necessary to call DefineUsedVTables() to enable (at
least) the emission of implicitly defined destructors overriding
the virtual destructor in a base class, see the added test.
2022-12-09 08:44:19 +01:00

41 lines
937 B
C

//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
// RUN: cat %s | %cling -Xclang -verify 2>&1 | FileCheck %s
// Test that the interpreter properly generates implicitly defined destructors
// overriding the virtual destructor in the base class.
// expected-no-diagnostics
.rawInput
extern "C" int printf(const char*,...);
class A {
public:
virtual ~A() {
printf("A::~A()\n");
}
};
class B : public A {
public:
B() {
printf("B::B()\n");
}
};
.rawInput
// CHECK-NOT: error
// CHECK-NOT: Symbols not found
// CHECK: B::B()
A *b = new B;
// CHECK: A::~A()
delete b;