[llvm-bugs] [Bug 32837] New: virtual destructor not called
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 27 23:58:52 PDT 2017
http://bugs.llvm.org/show_bug.cgi?id=32837
Bug ID: 32837
Summary: virtual destructor not called
Product: clang
Version: 4.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: programmerjake at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
the S2::~S2() is not called in the following code. This is easiest to see by
compiling with -O because main is optimized to return 0 and do nothing else.
struct S
{
virtual ~S()
{
}
};
struct S2 : public S
{
virtual ~S2()
{
__builtin_printf("never reached\n");
}
};
int main()
{
delete [] static_cast<S *>(new S2[1]);
}
clang version 4.0.0 (tags/RELEASE_400/final 299826)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-4.0.0/bin
See: https://godbolt.org/g/SlDwMr
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170428/8c4df1e9/attachment.html>
More information about the llvm-bugs
mailing list