diff options
author | Eric Fiselier <eric@efcs.ca> | 2019-05-23 23:46:44 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2019-05-23 23:46:44 +0000 |
commit | ae02e8944807c7b611ca3645a983c62d464f27a4 (patch) | |
tree | ac2437b2aca07fcb3cd9239bf56142a85c74aa29 /libcxx/include/new | |
parent | ffafdb9afc84126fe3156b8075bc3d7d3dad6dfe (diff) | |
download | bcm5719-llvm-ae02e8944807c7b611ca3645a983c62d464f27a4.tar.gz bcm5719-llvm-ae02e8944807c7b611ca3645a983c62d464f27a4.zip |
P0722R3: Implement library support for destroying delete
Summary:
This provides the `std::destroying_delete_t` declaration in C++2a and after. (Even when the compiler doesn't support the language feature).
However, the feature test macro `__cpp_lib_destroying_delete` is only defined when we have both language support and C++2a.
Reviewers: ldionne, ckennelly, serge-sans-paille, EricWF
Reviewed By: EricWF
Subscribers: dexonsmith, riccibruno, christof, jwakely, jdoerfert, mclow.lists, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D55840
llvm-svn: 361572
Diffstat (limited to 'libcxx/include/new')
-rw-r--r-- | libcxx/include/new | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libcxx/include/new b/libcxx/include/new index 4cf4c4c1e7b..85e4c4b3fcf 100644 --- a/libcxx/include/new +++ b/libcxx/include/new @@ -33,6 +33,12 @@ public: }; enum class align_val_t : size_t {}; // C++17 + +struct destroying_delete_t { // C++20 + explicit destroying_delete_t() = default; +}; +inline constexpr destroying_delete_t destroying_delete{}; // C++20 + struct nothrow_t {}; extern const nothrow_t nothrow; typedef void (*new_handler)(); @@ -158,6 +164,15 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif #endif +#if _LIBCPP_STD_VER > 17 +// Enable the declaration even if the compiler doesn't support the language +// feature. +struct destroying_delete_t { + explicit destroying_delete_t() = default; +}; +_LIBCPP_INLINE_VAR constexpr destroying_delete_t destroying_delete{}; +#endif // _LIBCPP_STD_VER > 17 + } // std #if defined(_LIBCPP_CXX03_LANG) |