[PATCH] D16206: Make -Wdelete-non-virtual-dtor warn on explicit `a->~A()` dtor calls too.
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 14 16:41:50 PST 2016
thakis created this revision.
thakis added a reviewer: rtrieu.
thakis added a subscriber: cfe-commits.
-Wdelete-non-virtual-dtor warns if A is a type with virtual functions but without virtual dtor has its constructor called via `delete a`. This makes the warning also fire if the dtor is called via `a->~A()`. This would've found a security bug in Chromium at compile time. Fixes PR26137.
Includes fixit for silencing the warning:
```
test.cc:12:3: warning: destructor called on 'B' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
b->~B(); // No warning.
^
test.cc:12:6: note: qualify call to silence this warning
b->~B(); // No warning.
^
B::
```
http://reviews.llvm.org/D16206
Files:
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaOverload.cpp
test/SemaCXX/destructor.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16206.44948.patch
Type: text/x-patch
Size: 7741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160115/54b17d6d/attachment.bin>
More information about the cfe-commits
mailing list