Commit Graph

6 Commits

Author SHA1 Message Date
Richard Smith aab25fa7d8 Never call a destroying operator delete when cleaning up from an
exception thrown during construction in a new-expression.

Instead, when performing deallocation function lookup for a
new-expression, ignore all destroying operator delete candidates, and
fall back to global operator delete if there is no member operator
delete other than a destroying operator delete.

Use of destroying operator delete only makes sense when there is an
object to destroy, which there isn't in this case. The language wording
doesn't cover this case; this oversight has been reported to WG21, with
the approach in this patch as the proposed fix.
2021-01-08 16:51:47 -08:00
Richard Smith 735ab86b81 PR47474: Add test for Clang's current behavior.
Our current behavior rejects the example, following the current language
rules, but it's likely the rules will be revised to allow this example.
2020-12-16 12:01:00 -08:00
Richard Smith 903bda14c3 PR46640: Permit the first parameter of a destroying 'operator delete' to
be dependent if it names the right type.

This matches the GCC behavior, but no longer matches the standard
wording. However, the standard wording in this case is not in line with
the intent, which was to require the enclosing class type to be named
directly. I've reported this wording oversight to the committee.
2020-07-08 14:29:39 -07:00
Eric Fiselier 24a2a48bc2 Fix handling of usual deallocation functions in various configuratios.
Clang allows users to enable or disable various types of allocation
and deallocation regardless of the C++ dialect. When extended new/delete
overloads are enabled in older dialects, we need to treat them as if
they're usual.

Also, disabling one usual deallocation form shouldn't
disable any others. For example, disabling aligned allocation in C++2a
should have no effect on destroying delete.

llvm-svn: 352980
2019-02-03 03:44:31 +00:00
Richard Smith 251720194f P0722R2: The first parameter in an implicit call to a destroying operator
delete should be a cv-unqualified pointer to the deleted object.

llvm-svn: 319858
2017-12-05 23:54:25 +00:00
Richard Smith 5b34958b46 Support for destroying operator delete, per C++2a proposal P0722.
This feature is not (yet) approved by the C++ committee, so this is liable to
be reverted or significantly modified based on committee feedback.

No functionality change intended for existing code (a new type must be defined
in namespace std to take advantage of this feature).

llvm-svn: 315662
2017-10-13 01:55:36 +00:00