diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 65f4ad2b2..866ae4a84 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -788,16 +788,20 @@ public: using value_type = _Ty; +#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef _Ty* pointer; _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const _Ty* const_pointer; _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef _Ty& reference; _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const _Ty& const_reference; +#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS using size_type = size_t; using difference_type = ptrdiff_t; - using propagate_on_container_move_assignment = true_type; + using propagate_on_container_move_assignment = true_type; + +#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS using is_always_equal _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = true_type; template @@ -812,6 +816,7 @@ public: _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD const _Ty* address(const _Ty& _Val) const noexcept { return _STD addressof(_Val); } +#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS constexpr allocator() noexcept {} @@ -830,6 +835,7 @@ public: return static_cast<_Ty*>(_Allocate<_New_alignof<_Ty>>(_Get_size_of_n(_Count))); } +#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD __declspec(allocator) _Ty* allocate( _CRT_GUARDOVERFLOW const size_t _Count, const void*) { return allocate(_Count); @@ -848,6 +854,7 @@ public: _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD size_t max_size() const noexcept { return static_cast(-1) / sizeof(_Ty); } +#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS }; // CLASS allocator @@ -855,19 +862,24 @@ template <> class allocator { public: using value_type = void; +#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef void* pointer; _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const void* const_pointer; +#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS using size_type = size_t; using difference_type = ptrdiff_t; - using propagate_on_container_move_assignment = true_type; + using propagate_on_container_move_assignment = true_type; + +#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS using is_always_equal _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = true_type; template struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind { using other = allocator<_Other>; }; +#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS }; template diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index f67118ff7..ce9b36d67 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1027,6 +1027,10 @@ #define _HAS_DEPRECATED_ADAPTOR_TYPEDEFS (_HAS_FEATURES_REMOVED_IN_CXX20) #endif // _HAS_DEPRECATED_ADAPTOR_TYPEDEFS +#ifndef _HAS_DEPRECATED_ALLOCATOR_MEMBERS +#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS (_HAS_FEATURES_REMOVED_IN_CXX20) +#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS + #ifndef _HAS_DEPRECATED_IS_LITERAL_TYPE #define _HAS_DEPRECATED_IS_LITERAL_TYPE (_HAS_FEATURES_REMOVED_IN_CXX20) #endif // _HAS_DEPRECATED_IS_LITERAL_TYPE diff --git a/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp b/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp index aa38f7b4c..d1c74c1e5 100644 --- a/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp +++ b/tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp @@ -3,6 +3,7 @@ // Test DevDiv-920385 ": list::sort shouldn't default-construct allocators". +#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS 1 #define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING #include diff --git a/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp b/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp index c00a3dd8e..3ad5fb18b 100644 --- a/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp +++ b/tests/std/tests/VSO_0000000_instantiate_iterators_misc/test.compile.pass.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #define _HAS_DEPRECATED_ADAPTOR_TYPEDEFS 1 +#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS 1 #define _HAS_DEPRECATED_NEGATORS 1 #define _HAS_DEPRECATED_RAW_STORAGE_ITERATOR 1 #define _HAS_DEPRECATED_TEMPORARY_BUFFER 1 diff --git a/tests/tr1/tests/memory/test.cpp b/tests/tr1/tests/memory/test.cpp index 897339b78..5daa40cb0 100644 --- a/tests/tr1/tests/memory/test.cpp +++ b/tests/tr1/tests/memory/test.cpp @@ -5,6 +5,7 @@ #define TEST_NAME "" #define _HAS_AUTO_PTR_ETC 1 +#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS 1 #define _HAS_DEPRECATED_RAW_STORAGE_ITERATOR 1 #define _HAS_DEPRECATED_TEMPORARY_BUFFER 1 #define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING