[LLVMbugs] [Bug 9197] New: derived virtual destructor not called
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Feb 10 19:19:21 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9197
Summary: derived virtual destructor not called
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: nlewycky at google.com
CC: llvmbugs at cs.uiuc.edu
This C++ test program should print "destructed!":
extern "C" int puts(const char *);
struct Test { ~Test() { puts("destructed!"); } };
struct Base {
virtual ~Base();
};
Base::~Base() { }
namespace {
struct Deriv : public Base {
Test t[1];
};
}
int main(void) {
Base *b = new Deriv();
delete b;
};
but doesn't when compiled by clang. The Base::~Base() destructor is called, but
not Deriv, which means that Test is never torn down. Either removing Deriv from
the anonymous namespace or making 't' not be an array masks the bug.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list