diff --git a/libcxx/docs/Cxx2aStatus.rst b/libcxx/docs/Cxx2aStatus.rst --- a/libcxx/docs/Cxx2aStatus.rst +++ b/libcxx/docs/Cxx2aStatus.rst @@ -43,7 +43,7 @@ .. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class], |sect|\ [mem.poly.allocator.class], and |sect|\ [container.node.overview]. .. [#note-P0966] P0966: It was previously erroneously marked as complete in version 8.0. See `bug 45368 `__. - .. [#note-P0619] P0619: Only ``std::allocator`` part is implemented. + .. [#note-P0619] P0619: Only sections D.9 and D.10 are implemented. Section D.8 is partly implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone. .. _issues-status-cxx2a: @@ -56,4 +56,4 @@ :header-rows: 1 :widths: auto -Last Updated: 24-Nov-2020 +Last Updated: 24-May-2021 diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -220,12 +220,23 @@ This macro is used to re-enable all the features removed in C++17. The effect is equivalent to manually defining each macro listed below. -**_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS**: - This macro is used to re-enable the `set_unexpected`, `get_unexpected`, and - `unexpected` functions, which were removed in C++17. - **_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR**: - This macro is used to re-enable `std::auto_ptr` in C++17. + This macro is used to re-enable `auto_ptr`. + +**_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS**: + This macro is used to re-enable the `binder1st`, `binder2nd`, + `pointer_to_unary_function`, `pointer_to_binary_function`, `mem_fun_t`, + `mem_fun1_t`, `mem_fun_ref_t`, `mem_fun1_ref_t`, `const_mem_fun_t`, + `const_mem_fun1_t`, `const_mem_fun_ref_t`, and `const_mem_fun1_ref_t` + class templates, and the `bind1st`, `bind2nd`, `mem_fun`, `mem_fun_ref`, + and `ptr_fun` functions. + +**_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE**: + This macro is used to re-enable the `random_shuffle` algorithm. + +**_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS**: + This macro is used to re-enable `set_unexpected`, `get_unexpected`, and + `unexpected`. C++20 Specific Configuration Macros: ------------------------------------ @@ -234,6 +245,24 @@ ``[[nodiscard]]`` in dialects after C++17. See :ref:`Extended Applications of [[nodiscard]] ` for more information. +**_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES**: + This macro is used to re-enable all the features removed in C++20. The effect + is equivalent to manually defining each macro listed below. + +**_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS**: + This macro is used to re-enable redundant members of `allocator`, + including `pointer`, `reference`, `rebind`, `address`, `max_size`, + `construct`, `destroy`, and the two-argument overload of `allocate`. + It also re-enables the library-provided explicit specializations + of `allocator` and `allocator`. + +**_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS**: + This macro is used to re-enable `not1`, `not2`, `unary_negate`, + and `binary_negate`. + +**_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR**: + This macro is used to re-enable `raw_storage_iterator`. + Libc++ Extensions ================= diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1363,11 +1363,17 @@ #if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) #define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE #define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS #endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES +#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) +#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS +#define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS +#define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR +#endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES + #if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 #define _LIBCPP_HAS_NO_DEDUCTION_GUIDES #endif diff --git a/libcxx/include/__memory/raw_storage_iterator.h b/libcxx/include/__memory/raw_storage_iterator.h --- a/libcxx/include/__memory/raw_storage_iterator.h +++ b/libcxx/include/__memory/raw_storage_iterator.h @@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER <= 17 +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR) template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 raw_storage_iterator @@ -54,7 +54,7 @@ #endif }; -#endif // _LIBCPP_STD_VER <= 17 +#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR) _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/functional b/libcxx/include/functional --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -192,7 +192,7 @@ struct identity; // C++20 template -class unary_negate // deprecated in C++17 +class unary_negate // deprecated in C++17, removed in C++20 : public unary_function { public: @@ -200,11 +200,11 @@ bool operator()(const typename Predicate::argument_type& x) const; }; -template // deprecated in C++17 +template // deprecated in C++17, removed in C++20 unary_negate not1(const Predicate& pred); template -class binary_negate // deprecated in C++17 +class binary_negate // deprecated in C++17, removed in C++20 : public binary_function @@ -215,7 +215,7 @@ const typename Predicate::second_argument_type& y) const; }; -template // deprecated in C++17 +template // deprecated in C++17, removed in C++20 binary_negate not2(const Predicate& pred); template @@ -1008,6 +1008,7 @@ }; #endif +#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) template class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 unary_negate : public unary_function @@ -1048,6 +1049,7 @@ _LIBCPP_DEPRECATED_IN_CXX17 inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY binary_negate<_Predicate> not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);} +#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS) #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) template diff --git a/libcxx/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.verify.cpp b/libcxx/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.verify.cpp --- a/libcxx/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.verify.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/binary_negate.depr_in_cxx17.verify.cpp @@ -13,6 +13,7 @@ // UNSUPPORTED: clang-4.0 // UNSUPPORTED: c++03, c++11, c++14 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS #include diff --git a/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp --- a/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/binary_negate.pass.cpp @@ -10,6 +10,7 @@ // binary_negate +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include diff --git a/libcxx/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.verify.cpp b/libcxx/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.verify.cpp --- a/libcxx/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.verify.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/not1.depr_in_cxx17.verify.cpp @@ -13,6 +13,7 @@ // UNSUPPORTED: clang-4.0 // UNSUPPORTED: c++03, c++11, c++14 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS #include diff --git a/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp --- a/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/not1.pass.cpp @@ -10,6 +10,7 @@ // not1 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include diff --git a/libcxx/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.verify.cpp b/libcxx/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.verify.cpp --- a/libcxx/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.verify.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/not2.depr_in_cxx17.verify.cpp @@ -13,6 +13,7 @@ // UNSUPPORTED: clang-4.0 // UNSUPPORTED: c++03, c++11, c++14 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS #include diff --git a/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp --- a/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/not2.pass.cpp @@ -10,6 +10,7 @@ // not2 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include diff --git a/libcxx/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.verify.cpp b/libcxx/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.verify.cpp --- a/libcxx/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.verify.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/unary_negate.depr_in_cxx17.verify.cpp @@ -13,6 +13,7 @@ // UNSUPPORTED: clang-4.0 // UNSUPPORTED: c++03, c++11, c++14 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS #include diff --git a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp --- a/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp +++ b/libcxx/test/std/utilities/function.objects/negators/unary_negate.pass.cpp @@ -10,6 +10,7 @@ // unary_negate +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS #include diff --git a/libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp b/libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp --- a/libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp +++ b/libcxx/test/std/utilities/memory/storage.iterator/deprecated.verify.cpp @@ -6,7 +6,8 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: c++17 +// UNSUPPORTED: c++03, c++11, c++14 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR // std::raw_storage_iterator diff --git a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp --- a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp +++ b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp @@ -6,12 +6,11 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: c++03 || c++11 || c++14 || c++17 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // raw_storage_iterator -#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS - #include #include #include diff --git a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp --- a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp +++ b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.pass.cpp @@ -6,12 +6,11 @@ // //===----------------------------------------------------------------------===// -// REQUIRES: c++03 || c++11 || c++14 || c++17 +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS // raw_storage_iterator -#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS - #include #include #include