[PATCH] D57645: [C++2a] Fix PR40576: Turn destroying delete off prior to C++2a. Add -fdestroying-delete

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 2 20:29:16 PST 2019


EricWF created this revision.
EricWF added reviewers: ckennelly, rsmith.
Herald added a project: clang.

Defining new names in namespace `std` is technically a non-conforming extensions. This makes it difficult for libc++ to backport C++20 destroying delete.
This patch should make it easier for libc++ to support destroying delete as an extension.

Currently Clang unconditionally defines `__cpp_impl_destroying_delete`. Unlike aligned allocation or sized deallocation which can be turned on or off by user.
I believe we should make destroying delete act similarly. It should be off prior to C++20 and  we should provide flags for enabling destroying delete prior to C++20.
This patch does just that.

There are some weird corner cases though. What should Clang do when it sees a destroying delete overload but `LangOpts.DestroyingDelete` isn't enabled?
My current approach is to tolerate it's existence, but ignore it for the purposes of overload resolution (after emitting a warning).

With this patch, if Clang see
When a destroying delete function is found


Repository:
  rC Clang

https://reviews.llvm.org/D57645

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td
  lib/AST/DeclCXX.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/InitPreprocessor.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExprCXX.cpp
  test/CodeGenCXX/cxx2a-destroying-delete.cpp
  test/SemaCXX/cxx2a-destroying-delete.cpp
  test/SemaCXX/extended-usual-deallocation-functions.cpp
  test/SemaCXX/warn-destroying-delete-extension.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57645.184927.patch
Type: text/x-patch
Size: 10641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190203/afd78b9c/attachment-0001.bin>


More information about the cfe-commits mailing list