[llvm-bugs] [Bug 35517] Delete called in virtual destructor

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 6 06:39:37 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35517

Konstantin Morshnev <moko at design.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

--- Comment #3 from Konstantin Morshnev <moko at design.ru> ---
> has a good description of deleting destructors.

The description is clear and we know it. But it is about dynamic objects
(MyStruct *ss=new MyStruct), and we have a stack object (MyStruct ss).

And if you'll and some printfs (like https://godbolt.org/g/fW4QZk) you'll see,
that delete is not called. It looks like there are two destructor versions are
generated - one with delete call and one without. But if the one with delete is
not referenced, why it is not optimized out?

> FWIW, your testcase only compiles in GCC 6.1 because they changed their default standard mode to C++14

Thx for this note.

P.S. As a workaround we are temporary disabling virtual destructors to check
that build-in delete is not used in our code, but it's not very convenient.

-- 
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/20171206/1cd6f47e/attachment.html>


More information about the llvm-bugs mailing list