[libcxx-commits] [libcxx] 5b1e5b4 - [libc++][P0174] Deprecated/removed parts of default allocator.

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 4 09:06:54 PST 2020


Author: Michael Park
Date: 2020-03-04T12:06:26-05:00
New Revision: 5b1e5b4338d173e0f290f1b3b245194257ec8d4c

URL: https://github.com/llvm/llvm-project/commit/5b1e5b4338d173e0f290f1b3b245194257ec8d4c
DIFF: https://github.com/llvm/llvm-project/commit/5b1e5b4338d173e0f290f1b3b245194257ec8d4c.diff

LOG: [libc++][P0174] Deprecated/removed parts of default allocator.

Differential Revision: https://reviews.llvm.org/D70117

Added: 
    libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
    libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp

Modified: 
    libcxx/include/memory
    libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp
    libcxx/test/std/containers/sequences/deque/types.pass.cpp
    libcxx/test/std/containers/sequences/list/types.pass.cpp
    libcxx/test/std/containers/sequences/vector/types.pass.cpp
    libcxx/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp
    libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
    libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
    libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
    libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
    libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp
    libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp

Removed: 
    libcxx/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp
    libcxx/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
    libcxx/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
    libcxx/test/std/utilities/memory/default.allocator/allocator_void.pass.cpp


################################################################################
diff  --git a/libcxx/include/memory b/libcxx/include/memory
index ec309d14f325..9d56e8167b47 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -80,7 +80,7 @@ struct allocator_traits
     typedef Alloc::is_always_equal
           | is_empty                     is_always_equal;
 
-    template <class T> using rebind_alloc  = Alloc::rebind<U>::other | Alloc<T, Args...>;
+    template <class T> using rebind_alloc  = Alloc::rebind<T>::other | Alloc<T, Args...>;
     template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
 
     static pointer allocate(allocator_type& a, size_type n);                          // [[nodiscard]] in C++20
@@ -101,7 +101,7 @@ struct allocator_traits
 };
 
 template <>
-class allocator<void>
+class allocator<void> // deprecated in C++17, removed in C++20
 {
 public:
     typedef void*                                 pointer;
@@ -115,30 +115,37 @@ template <class T>
 class allocator
 {
 public:
-    typedef size_t                                size_type;
-    typedef ptr
diff _t                             
diff erence_type;
-    typedef T*                                    pointer;
-    typedef const T*                              const_pointer;
-    typedef typename add_lvalue_reference<T>::type       reference;
-    typedef typename add_lvalue_reference<const T>::type const_reference;
-    typedef T                                     value_type;
+    typedef size_t    size_type;                         // deprecated in C++17, removed in C++20
+    typedef ptr
diff _t 
diff erence_type;                   // deprecated in C++17, removed in C++20
+    typedef T*        pointer;                           // deprecated in C++17, removed in C++20
+    typedef const T*  const_pointer;                     // deprecated in C++17, removed in C++20
+    typedef typename add_lvalue_reference<T>::type
+                      reference;                         // deprecated in C++17, removed in C++20
+    typedef typename add_lvalue_reference<const T>::type
+                      const_reference;                   // deprecated in C++17, removed in C++20
 
-    template <class U> struct rebind {typedef allocator<U> other;};
+    typedef T         value_type;
+
+    template <class U> struct rebind {typedef allocator<U> other;}; // deprecated in C++17, removed in C++20
+
+    typedef true_type propagate_on_container_move_assignment;
+    typedef true_type is_always_equal;
 
     constexpr allocator() noexcept;                      // constexpr in C++20
     constexpr allocator(const allocator&) noexcept;      // constexpr in C++20
     template <class U>
       constexpr allocator(const allocator<U>&) noexcept; // constexpr in C++20
     ~allocator();
-    pointer address(reference x) const noexcept;
-    const_pointer address(const_reference x) const noexcept;
-    pointer allocate(size_type, allocator<void>::const_pointer hint = 0);
-    void deallocate(pointer p, size_type n) noexcept;
-    size_type max_size() const noexcept;
+    pointer address(reference x) const noexcept;             // deprecated in C++17, removed in C++20
+    const_pointer address(const_reference x) const noexcept; // deprecated in C++17, removed in C++20
+    T* allocate(size_t n, const void* hint);          // deprecated in C++17, removed in C++20
+    T* allocate(size_t n);
+    void deallocate(T* p, size_t n) noexcept;
+    size_type max_size() const noexcept;              // deprecated in C++17, removed in C++20
     template<class U, class... Args>
-        void construct(U* p, Args&&... args);
+        void construct(U* p, Args&&... args);         // deprecated in C++17, removed in C++20
     template <class U>
-        void destroy(U* p);
+        void destroy(U* p);                           // deprecated in C++17, removed in C++20
 };
 
 template <class T, class U>
@@ -705,8 +712,9 @@ _ValueType __libcpp_acquire_load(_ValueType const* __value) {
 
 template <class _Tp> class allocator;
 
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
 template <>
-class _LIBCPP_TEMPLATE_VIS allocator<void>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<void>
 {
 public:
     typedef void*             pointer;
@@ -717,7 +725,7 @@ public:
 };
 
 template <>
-class _LIBCPP_TEMPLATE_VIS allocator<const void>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 allocator<const void>
 {
 public:
     typedef const void*       pointer;
@@ -726,6 +734,7 @@ public:
 
     template <class _Up> struct rebind {typedef allocator<_Up> other;};
 };
+#endif
 
 // pointer_traits
 
@@ -832,16 +841,12 @@ struct __pointer_traits_
diff erence_type<_Ptr, true>
     typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::
diff erence_type type;
 };
 
+template <class _Tp, class _Up, class = void>
+struct __has_rebind : false_type {};
+
 template <class _Tp, class _Up>
-struct __has_rebind
-{
-private:
-    struct __two {char __lx; char __lxx;};
-    template <class _Xp> static __two __test(...);
-    template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
-public:
-    static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_rebind<_Tp, _Up,
+    typename __void_t<typename _Tp::template rebind<_Up> >::type> : true_type {};
 
 template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
 struct __pointer_traits_rebind
@@ -1266,7 +1271,9 @@ struct __has_rebind_other
 private:
     struct __two {char __lx; char __lxx;};
     template <class _Xp> static __two __test(...);
+    _LIBCPP_SUPPRESS_DEPRECATED_PUSH
     template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0);
+    _LIBCPP_SUPPRESS_DEPRECATED_POP
 public:
     static const bool value = sizeof(__test<_Tp>(0)) == 1;
 };
@@ -1280,7 +1287,9 @@ struct __has_rebind_other<_Tp, _Up, false>
 template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
 struct __allocator_traits_rebind
 {
+    _LIBCPP_SUPPRESS_DEPRECATED_PUSH
     typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
+    _LIBCPP_SUPPRESS_DEPRECATED_POP
 };
 
 #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1288,7 +1297,9 @@ struct __allocator_traits_rebind
 template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
 struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
 {
+    _LIBCPP_SUPPRESS_DEPRECATED_PUSH
     typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
+    _LIBCPP_SUPPRESS_DEPRECATED_POP
 };
 
 template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
@@ -1355,10 +1366,12 @@ struct __allocator_traits_rebind<_Alloc<_Tp, _A0, _A1, _A2>, _Up, false>
 
 #ifndef _LIBCPP_CXX03_LANG
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Alloc, class _SizeType, class _ConstVoidPtr>
 auto
 __has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
     -> decltype((void)__a.allocate(__sz, __p), true_type());
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 template <class _Alloc, class _SizeType, class _ConstVoidPtr>
 auto
@@ -1367,12 +1380,9 @@ __has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __
 
 template <class _Alloc, class _SizeType, class _ConstVoidPtr>
 struct __has_allocate_hint
-    : integral_constant<bool,
-        is_same<
-            decltype(_VSTD::__has_allocate_hint_test(declval<_Alloc>(),
-                                          declval<_SizeType>(),
-                                          declval<_ConstVoidPtr>())),
-            true_type>::value>
+    : decltype(_VSTD::__has_allocate_hint_test(declval<_Alloc>(),
+                                               declval<_SizeType>(),
+                                               declval<_ConstVoidPtr>()))
 {
 };
 
@@ -1388,31 +1398,32 @@ struct __has_allocate_hint
 
 #if !defined(_LIBCPP_CXX03_LANG)
 
-template <class _Alloc, class _Tp, class ..._Args>
-decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(),
-                                           _VSTD::declval<_Args>()...),
-                                           true_type())
-__has_construct_test(_Alloc&& __a, _Tp* __p, _Args&& ...__args);
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+template <class _Alloc, class _Tp, class... _Args>
+auto
+__has_construct_test(_Alloc&& __a, _Tp* __p, _Args&&... __args)
+    -> decltype(__a.construct(__p, _VSTD::forward<_Args>(__args)...), true_type());
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 template <class _Alloc, class _Pointer, class ..._Args>
-false_type
-__has_construct_test(const _Alloc& __a, _Pointer&& __p, _Args&& ...__args);
+auto
+__has_construct_test(const _Alloc& __a, _Pointer&& __p, _Args&& ...__args)
+    -> false_type;
 
 template <class _Alloc, class _Pointer, class ..._Args>
 struct __has_construct
-    : integral_constant<bool,
-        is_same<
-            decltype(_VSTD::__has_construct_test(declval<_Alloc>(),
-                                          declval<_Pointer>(),
-                                          declval<_Args>()...)),
-            true_type>::value>
+    : decltype(_VSTD::__has_construct_test(declval<_Alloc>(),
+                                           declval<_Pointer>(),
+                                           declval<_Args>()...))
 {
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Alloc, class _Pointer>
 auto
 __has_destroy_test(_Alloc&& __a, _Pointer&& __p)
     -> decltype(__a.destroy(__p), true_type());
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 template <class _Alloc, class _Pointer>
 auto
@@ -1421,18 +1432,17 @@ __has_destroy_test(const _Alloc& __a, _Pointer&& __p)
 
 template <class _Alloc, class _Pointer>
 struct __has_destroy
-    : integral_constant<bool,
-        is_same<
-            decltype(_VSTD::__has_destroy_test(declval<_Alloc>(),
-                                        declval<_Pointer>())),
-            true_type>::value>
+    : decltype(_VSTD::__has_destroy_test(declval<_Alloc>(),
+                                         declval<_Pointer>()))
 {
 };
 
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
 template <class _Alloc>
 auto
 __has_max_size_test(_Alloc&& __a)
     -> decltype(__a.max_size(), true_type());
+_LIBCPP_SUPPRESS_DEPRECATED_POP
 
 template <class _Alloc>
 auto
@@ -1441,10 +1451,7 @@ __has_max_size_test(const volatile _Alloc& __a)
 
 template <class _Alloc>
 struct __has_max_size
-    : integral_constant<bool,
-        is_same<
-            decltype(_VSTD::__has_max_size_test(declval<_Alloc&>())),
-            true_type>::value>
+    : decltype(_VSTD::__has_max_size_test(declval<_Alloc&>()))
 {
 };
 
@@ -1460,10 +1467,7 @@ __has_select_on_container_copy_construction_test(const volatile _Alloc& __a)
 
 template <class _Alloc>
 struct __has_select_on_container_copy_construction
-    : integral_constant<bool,
-        is_same<
-            decltype(_VSTD::__has_select_on_container_copy_construction_test(declval<_Alloc&>())),
-            true_type>::value>
+    : decltype(_VSTD::__has_select_on_container_copy_construction_test(declval<_Alloc&>()))
 {
 };
 
@@ -1755,7 +1759,11 @@ private:
     _LIBCPP_INLINE_VISIBILITY
     static pointer __allocate(allocator_type& __a, size_type __n,
         const_void_pointer __hint, true_type)
-        {return __a.allocate(__n, __hint);}
+        {
+            _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+            return __a.allocate(__n, __hint);
+            _LIBCPP_SUPPRESS_DEPRECATED_POP
+        }
     _LIBCPP_INLINE_VISIBILITY
     static pointer __allocate(allocator_type& __a, size_type __n,
         const_void_pointer, false_type)
@@ -1765,7 +1773,12 @@ private:
     template <class _Tp, class... _Args>
         _LIBCPP_INLINE_VISIBILITY
         static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args)
-            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
+            {
+                _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+                __a.construct(__p, _VSTD::forward<_Args>(__args)...);
+                _LIBCPP_SUPPRESS_DEPRECATED_POP
+            }
+
     template <class _Tp, class... _Args>
         _LIBCPP_INLINE_VISIBILITY
         static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args)
@@ -1790,7 +1803,11 @@ private:
     template <class _Tp>
         _LIBCPP_INLINE_VISIBILITY
         static void __destroy(true_type, allocator_type& __a, _Tp* __p)
-            {__a.destroy(__p);}
+            {
+                _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+                __a.destroy(__p);
+                _LIBCPP_SUPPRESS_DEPRECATED_POP
+            }
     template <class _Tp>
         _LIBCPP_INLINE_VISIBILITY
         static void __destroy(false_type, allocator_type&, _Tp* __p)
@@ -1800,7 +1817,12 @@ private:
 
     _LIBCPP_INLINE_VISIBILITY
     static size_type __max_size(true_type, const allocator_type& __a) _NOEXCEPT
-            {return __a.max_size();}
+            {
+                _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+                return __a.max_size();
+                _LIBCPP_SUPPRESS_DEPRECATED_POP
+            }
+
     _LIBCPP_INLINE_VISIBILITY
     static size_type __max_size(false_type, const allocator_type&) _NOEXCEPT
             {return numeric_limits<size_type>::max() / sizeof(value_type);}
@@ -1831,19 +1853,22 @@ template <class _Tp>
 class _LIBCPP_TEMPLATE_VIS allocator
 {
 public:
-    typedef size_t            size_type;
-    typedef ptr
diff _t         
diff erence_type;
-    typedef _Tp*              pointer;
-    typedef const _Tp*        const_pointer;
-    typedef _Tp&              reference;
-    typedef const _Tp&        const_reference;
-    typedef _Tp               value_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t     size_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef ptr
diff _t  
diff erence_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp*       pointer;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp&       reference;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
+
+    template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;};
+#endif
+
+    typedef _Tp value_type;
 
     typedef true_type propagate_on_container_move_assignment;
     typedef true_type is_always_equal;
 
-    template <class _Up> struct rebind {typedef allocator<_Up> other;};
-
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     allocator() _NOEXCEPT {}
 
@@ -1851,25 +1876,39 @@ public:
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     allocator(const allocator<_Up>&) _NOEXCEPT {}
 
-    _LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY
+    pointer address(reference __x) const _NOEXCEPT
         {return _VSTD::addressof(__x);}
-    _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
+    _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY
+    const_pointer address(const_reference __x) const _NOEXCEPT
         {return _VSTD::addressof(__x);}
-    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
-    pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
+#endif
+
+    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _Tp* allocate(size_t __n)
         {
-        if (__n > max_size())
+        // TODO(mpark): Replace with `allocator_traits<allocator>::max_size(*this)`.
+        if (__n > (size_t(~0) / sizeof(_Tp)))
             __throw_length_error("allocator<T>::allocate(size_t n)"
                                  " 'n' exceeds maximum supported size");
-        return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
+        return static_cast<_Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
         }
-    _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n) _NOEXCEPT
+
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17
+    _Tp* allocate(size_t __n, const void*) { return allocate(__n); }
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY void deallocate(_Tp* __p, size_t __n) _NOEXCEPT
         {_VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));}
-    _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
+
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
         {return size_type(~0) / sizeof(_Tp);}
+
 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
     template <class _Up, class... _Args>
-        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY
         void
         construct(_Up* __p, _Args&&... __args)
         {
@@ -1928,26 +1967,30 @@ public:
             ::new((void*)__p) _Tp(__a0, __a1);
         }
 #endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
-    _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
+    _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
+#endif
 };
 
 template <class _Tp>
 class _LIBCPP_TEMPLATE_VIS allocator<const _Tp>
 {
 public:
-    typedef size_t            size_type;
-    typedef ptr
diff _t         
diff erence_type;
-    typedef const _Tp*        pointer;
-    typedef const _Tp*        const_pointer;
-    typedef const _Tp&        reference;
-    typedef const _Tp&        const_reference;
-    typedef const _Tp         value_type;
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t     size_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef ptr
diff _t  
diff erence_type;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* pointer;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp* const_pointer;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& reference;
+    _LIBCPP_DEPRECATED_IN_CXX17 typedef const _Tp& const_reference;
+
+    template <class _Up> struct _LIBCPP_DEPRECATED_IN_CXX17 rebind {typedef allocator<_Up> other;};
+#endif
+
+    typedef const _Tp value_type;
 
     typedef true_type propagate_on_container_move_assignment;
     typedef true_type is_always_equal;
 
-    template <class _Up> struct rebind {typedef allocator<_Up> other;};
-
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     allocator() _NOEXCEPT {}
 
@@ -1955,22 +1998,36 @@ public:
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
     allocator(const allocator<_Up>&) _NOEXCEPT {}
 
-    _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY
+    const_pointer address(const_reference __x) const _NOEXCEPT
         {return _VSTD::addressof(__x);}
-    _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
+#endif
+
+    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY const _Tp* allocate(size_t __n)
     {
-        if (__n > max_size())
+        // TODO(mpark): Replace with `allocator_traits<allocator>::max_size(*this)`.
+        if (__n > (size_t(~0) / sizeof(_Tp)))
             __throw_length_error("allocator<const T>::allocate(size_t n)"
                                  " 'n' exceeds maximum supported size");
-        return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
+        return static_cast<const _Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
     }
-    _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n) _NOEXCEPT
+
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17
+    const _Tp* allocate(size_t __n, const void*) { return allocate(__n); }
+#endif
+
+    _LIBCPP_INLINE_VISIBILITY void deallocate(const _Tp* __p, size_t __n)
         {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));}
-    _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
+
+#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS)
+    _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
         {return size_type(~0) / sizeof(_Tp);}
+
 #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
     template <class _Up, class... _Args>
-        _LIBCPP_INLINE_VISIBILITY
+        _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY
         void
         construct(_Up* __p, _Args&&... __args)
         {
@@ -2029,7 +2086,8 @@ public:
             ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1);
         }
 #endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
-    _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
+    _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
+#endif
 };
 
 template <class _Tp, class _Up>

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
similarity index 65%
rename from libcxx/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp
rename to libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
index a1333619473d..0cf49df5422a 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/address.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.cxx2a.pass.cpp
@@ -12,6 +12,15 @@
 // pointer address(reference x) const;
 // const_pointer address(const_reference x) const;
 
+//  In C++20, parts of std::allocator<T> have been removed.
+//  However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+//  is defined before including <memory>, then removed members will be restored.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <memory>
 #include <cassert>
 

diff  --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp
new file mode 100644
index 000000000000..f659f43b230e
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/address.depr_in_cxx17.fail.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// pointer address(reference x) const;
+// const_pointer address(const_reference x) const;
+
+// Deprecated in C++17
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+
+#include <memory>
+#include "test_macros.h"
+
+int main(int, char**)
+{
+  int x = 0;
+  std::allocator<int> a;
+
+  int* p = a.address(x); // expected-error{{'address' is deprecated}}
+  (void)p;
+
+  return 0;
+}

diff  --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp
new file mode 100644
index 000000000000..db06f99f7f42
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.fail.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+// <memory>
+
+// allocator:
+// T* allocate(size_t n, const void* hint);
+
+//  In C++20, parts of std::allocator<T> have been removed.
+//  However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+//  is defined before including <memory>, then removed members will be restored.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <cassert>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    std::allocator<int> a;
+    a.allocate(3, nullptr); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
+
+  return 0;
+}

diff  --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
new file mode 100644
index 000000000000..1d83efa3bf0e
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
@@ -0,0 +1,95 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// T* allocate(size_t n, const void* hint);
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <cassert>
+#include <cstddef>       // for std::max_align_t
+
+#include "test_macros.h"
+#include "count_new.h"
+
+
+#ifdef TEST_HAS_NO_ALIGNED_ALLOCATION
+static const bool UsingAlignedNew = false;
+#else
+static const bool UsingAlignedNew = true;
+#endif
+
+#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
+static const size_t MaxAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__;
+#else
+static const size_t MaxAligned = std::alignment_of<std::max_align_t>::value;
+#endif
+
+static const size_t OverAligned = MaxAligned * 2;
+
+
+template <size_t Align>
+struct TEST_ALIGNAS(Align) AlignedType {
+  char data;
+  static int constructed;
+  AlignedType() { ++constructed; }
+  AlignedType(AlignedType const&) { ++constructed; }
+  ~AlignedType() { --constructed; }
+};
+template <size_t Align>
+int AlignedType<Align>::constructed = 0;
+
+
+template <size_t Align>
+void test_aligned() {
+  typedef AlignedType<Align> T;
+  T::constructed = 0;
+  globalMemCounter.reset();
+  std::allocator<T> a;
+  const bool IsOverAlignedType = Align > MaxAligned;
+  const bool ExpectAligned = IsOverAlignedType && UsingAlignedNew;
+  {
+    globalMemCounter.last_new_size = 0;
+    globalMemCounter.last_new_align = 0;
+    T* volatile ap2 = a.allocate(11, (const void*)5);
+    DoNotOptimize(ap2);
+    assert(globalMemCounter.checkOutstandingNewEq(1));
+    assert(globalMemCounter.checkNewCalledEq(1));
+    assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned));
+    assert(globalMemCounter.checkLastNewSizeEq(11 * sizeof(T)));
+    assert(globalMemCounter.checkLastNewAlignEq(ExpectAligned ? Align : 0));
+    assert(T::constructed == 0);
+    globalMemCounter.last_delete_align = 0;
+    a.deallocate(ap2, 11);
+    DoNotOptimize(ap2);
+    assert(globalMemCounter.checkOutstandingNewEq(0));
+    assert(globalMemCounter.checkDeleteCalledEq(1));
+    assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned));
+    assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0));
+    assert(T::constructed == 0);
+  }
+}
+
+int main(int, char**) {
+    test_aligned<1>();
+    test_aligned<2>();
+    test_aligned<4>();
+    test_aligned<8>();
+    test_aligned<16>();
+    test_aligned<MaxAligned>();
+    test_aligned<OverAligned>();
+    test_aligned<OverAligned * 2>();
+
+  return 0;
+}

diff  --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp
new file mode 100644
index 000000000000..dada041f62ee
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.depr_in_cxx17.fail.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// allocator:
+// T* allocate(size_t n, const void* hint);
+
+// Deprecated in C++17
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIERS: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+
+#include <memory>
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    std::allocator<int> a;
+    TEST_IGNORE_NODISCARD a.allocate(3, nullptr); // expected-error {{'allocate' is deprecated}}
+
+  return 0;
+}

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
similarity index 89%
rename from libcxx/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
rename to libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
index 328603b717f3..e86bfe2d3c42 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
@@ -11,6 +11,15 @@
 // allocator:
 // template <class... Args> void construct(pointer p, Args&&... args);
 
+//  In C++20, parts of std::allocator<T> have been removed.
+//  However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+//  is defined before including <memory>, then removed members will be restored.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <memory>
 #include <cassert>
 

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
similarity index 62%
rename from libcxx/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
rename to libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
index 2991bdfc31ec..2b6499f9b962 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/max_size.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/max_size.cxx2a.pass.cpp
@@ -11,6 +11,15 @@
 // allocator:
 // size_type max_size() const throw();
 
+//  In C++20, parts of std::allocator<T> have been removed.
+//  However, for backwards compatibility, if _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+//  is defined before including <memory>, then removed members will be restored.
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <memory>
 #include <limits>
 #include <cstddef>

diff  --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp
new file mode 100644
index 000000000000..6d8c49399de8
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.cxx2a.pass.cpp
@@ -0,0 +1,51 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// check nested types:
+
+// template <class T>
+// class allocator
+// {
+// public:
+//     typedef size_t                                size_type;
+//     typedef ptr
diff _t                             
diff erence_type;
+//     typedef T*                                    pointer;
+//     typedef const T*                              const_pointer;
+//     typedef typename add_lvalue_reference<T>::type       reference;
+//     typedef typename add_lvalue_reference<const T>::type const_reference;
+//
+//     template <class U> struct rebind {typedef allocator<U> other;};
+// ...
+// };
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
+#include <memory>
+#include <type_traits>
+#include <cstddef>
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
+    static_assert((std::is_same<std::allocator<char>::
diff erence_type, std::ptr
diff _t>::value), "");
+    static_assert((std::is_same<std::allocator<char>::pointer, char*>::value), "");
+    static_assert((std::is_same<std::allocator<char>::const_pointer, const char*>::value), "");
+    static_assert((std::is_same<std::allocator<char>::reference, char&>::value), "");
+    static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
+    static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
+                                std::allocator<int> >::value), "");
+
+  return 0;
+}

diff  --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp
new file mode 100644
index 000000000000..0bc5a60dc994
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_types.depr_in_cxx17.fail.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// check nested types:
+
+// template <class T>
+// class allocator
+// {
+// public:
+//     typedef size_t                                size_type;
+//     typedef ptr
diff _t                             
diff erence_type;
+//     typedef T*                                    pointer;
+//     typedef const T*                              const_pointer;
+//     typedef typename add_lvalue_reference<T>::type       reference;
+//     typedef typename add_lvalue_reference<const T>::type const_reference;
+//
+//     template <class U> struct rebind {typedef allocator<U> other;};
+// ...
+// };
+
+// Deprecated in C++17
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+
+#include <memory>
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    typedef std::allocator<char>::size_type AST;          // expected-error{{'size_type' is deprecated}}
+    typedef std::allocator<char>::
diff erence_type ADT;    // expected-error{{'
diff erence_type' is deprecated}}
+    typedef std::allocator<char>::pointer AP;             // expected-error{{'pointer' is deprecated}}
+    typedef std::allocator<char>::const_pointer ACP;      // expected-error{{'const_pointer' is deprecated}}
+    typedef std::allocator<char>::reference AR;           // expected-error{{'reference' is deprecated}}
+    typedef std::allocator<char>::const_reference ACR;    // expected-error{{'const_reference' is deprecated}}
+    typedef std::allocator<char>::rebind<int>::other ARO; // expected-error{{'rebind<int>' is deprecated}}
+
+  return 0;
+}

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_void.pass.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
similarity index 85%
rename from libcxx/test/std/utilities/memory/default.allocator/allocator_void.pass.cpp
rename to libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
index 7c091d3d97c6..a3dc9cb03725 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_void.pass.cpp
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.cxx2a.pass.cpp
@@ -19,6 +19,11 @@
 //     template <class _Up> struct rebind {typedef allocator<_Up> other;};
 // };
 
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+// MODULES_DEFINES: _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <memory>
 #include <type_traits>
 

diff  --git a/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp
new file mode 100644
index 000000000000..64b8ecda8d61
--- /dev/null
+++ b/libcxx/test/libcxx/depr/depr.default.allocator/allocator_void.depr_in_cxx17.fail.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+//
+// template <>
+// class allocator<void>
+// {
+// public:
+//     typedef void*                                 pointer;
+//     typedef const void*                           const_pointer;
+//     typedef void                                  value_type;
+//
+//     template <class _Up> struct rebind {typedef allocator<_Up> other;};
+// };
+//
+// Deprecated in C++17
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: verify-support
+
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+
+#include <memory>
+#include "test_macros.h"
+
+int main(int, char**)
+{
+    typedef std::allocator<void>::pointer AP;             // expected-error{{'allocator<void>' is deprecated}}
+    typedef std::allocator<void>::const_pointer ACP;      // expected-error{{'allocator<void>' is deprecated}}
+    typedef std::allocator<void>::rebind<int>::other ARO; // expected-error{{'allocator<void>' is deprecated}}
+
+  return 0;
+}

diff  --git a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp
index a4c43ba5d2aa..89d6ad0630bd 100644
--- a/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp
+++ b/libcxx/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp
@@ -73,7 +73,7 @@ int main(int, char**) {
     std::tuple<Base const&, int> t(ct, 42); // expected-note {{requested here}}
   }
   {
-    std::allocator<void> alloc;
+    std::allocator<int> alloc;
     std::tuple<std::string &&> t2("hello"); // expected-note {{requested here}}
     std::tuple<std::string &&> t3(std::allocator_arg, alloc, "hello"); // expected-note {{requested here}}
   }

diff  --git a/libcxx/test/std/containers/sequences/deque/types.pass.cpp b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
index 0881d89fc7de..7fd998921e61 100644
--- a/libcxx/test/std/containers/sequences/deque/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/types.pass.cpp
@@ -28,6 +28,9 @@
 //     typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
 // };
 
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <deque>
 #include <iterator>
 #include <type_traits>

diff  --git a/libcxx/test/std/containers/sequences/list/types.pass.cpp b/libcxx/test/std/containers/sequences/list/types.pass.cpp
index 6e6b07dde546..611eec4d99f7 100644
--- a/libcxx/test/std/containers/sequences/list/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/list/types.pass.cpp
@@ -21,6 +21,9 @@
 //     typedef typename allocator_type::pointer pointer;
 //     typedef typename allocator_type::const_pointer const_pointer;
 
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <list>
 #include <type_traits>
 

diff  --git a/libcxx/test/std/containers/sequences/vector/types.pass.cpp b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
index 3dbc9592c326..0357785bef80 100644
--- a/libcxx/test/std/containers/sequences/vector/types.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/types.pass.cpp
@@ -28,6 +28,9 @@
 //     typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
 // };
 
+#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
+#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS
+
 #include <vector>
 #include <iterator>
 #include <type_traits>

diff  --git a/libcxx/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp b/libcxx/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp
index 1691025848c6..b772ffe659a8 100644
--- a/libcxx/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp
+++ b/libcxx/test/std/experimental/memory/memory.resource.adaptor/memory.resource.adaptor.overview/overview.pass.cpp
@@ -23,7 +23,7 @@ namespace ex = std::experimental::pmr;
 
 int main(int, char**)
 {
-    typedef ex::resource_adaptor<std::allocator<void>> R;
+    typedef ex::resource_adaptor<std::allocator<int>> R;
     typedef ex::resource_adaptor<std::allocator<long>> R2;
     static_assert(std::is_same<R, R2>::value, "");
     {

diff  --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
index 46f33be68fe2..33f29627c1ce 100644
--- a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/alloc_rfunction.pass.cpp
@@ -83,7 +83,7 @@ int main(int, char**)
         assert(A::count == 1);
         assert(f.target<A>() == nullptr);
         assert(f.target<Ref>());
-        std::function<int(int)> f2(std::allocator_arg, std::allocator<void>{},
+        std::function<int(int)> f2(std::allocator_arg, std::allocator<int>{},
                                    std::move(f));
         assert(A::count == 1);
         assert(f2.target<A>() == nullptr);
@@ -99,7 +99,7 @@ int main(int, char**)
         std::function<int(int)> f(p);
         assert(f.target<A>() == nullptr);
         assert(f.target<Ptr>());
-        std::function<int(int)> f2(std::allocator_arg, std::allocator<void>(),
+        std::function<int(int)> f2(std::allocator_arg, std::allocator<int>(),
                                    std::move(f));
         assert(f2.target<A>() == nullptr);
         assert(f2.target<Ptr>());

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
index 889804f3b71a..4cbd29029331 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.fail.cpp
@@ -6,13 +6,13 @@
 //
 //===----------------------------------------------------------------------===//
 
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
 // <memory>
 
 // allocator:
-// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
-// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+// T* allocate(size_t n);
 
 #include <memory>
 #include <cassert>
@@ -23,7 +23,6 @@ int main(int, char**)
 {
     std::allocator<int> a;
     a.allocate(3);          // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
-    a.allocate(3, nullptr); // expected-error {{ignoring return value of function declared with 'nodiscard' attribute}}
 
   return 0;
 }

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
index cdf491bf5865..ff5287dc81a7 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
@@ -9,7 +9,7 @@
 // <memory>
 
 // allocator:
-// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
+// T* allocate(size_t n);
 
 #include <memory>
 #include <cassert>
@@ -75,27 +75,6 @@ void test_aligned() {
     assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0));
     assert(T::constructed == 0);
   }
-  globalMemCounter.reset();
-  {
-    globalMemCounter.last_new_size = 0;
-    globalMemCounter.last_new_align = 0;
-    T* volatile ap2 = a.allocate(11, (const void*)5);
-    DoNotOptimize(ap2);
-    assert(globalMemCounter.checkOutstandingNewEq(1));
-    assert(globalMemCounter.checkNewCalledEq(1));
-    assert(globalMemCounter.checkAlignedNewCalledEq(ExpectAligned));
-    assert(globalMemCounter.checkLastNewSizeEq(11 * sizeof(T)));
-    assert(globalMemCounter.checkLastNewAlignEq(ExpectAligned ? Align : 0));
-    assert(T::constructed == 0);
-    globalMemCounter.last_delete_align = 0;
-    a.deallocate(ap2, 11);
-    DoNotOptimize(ap2);
-    assert(globalMemCounter.checkOutstandingNewEq(0));
-    assert(globalMemCounter.checkDeleteCalledEq(1));
-    assert(globalMemCounter.checkAlignedDeleteCalledEq(ExpectAligned));
-    assert(globalMemCounter.checkLastDeleteAlignEq(ExpectAligned ? Align : 0));
-    assert(T::constructed == 0);
-  }
 }
 
 int main(int, char**) {

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
index 459b96ea244c..44dba831b3fb 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
@@ -10,7 +10,7 @@
 // <memory>
 
 // allocator:
-// pointer allocate(size_type n, allocator<void>::const_pointer hint=0);
+// T* allocate(size_t n);
 
 // When back-deploying to macosx10.7, the RTTI for exception classes
 // incorrectly provided by libc++.dylib is mixed with the one in
@@ -37,9 +37,11 @@ template <typename T>
 void test()
 {
     // Bug 26812 -- allocating too large
-    std::allocator<T> a;
-    test_max<T> (a.max_size() + 1);                // just barely too large
-    test_max<T> (a.max_size() * 2);                // significantly too large
+    typedef std::allocator<T> A;
+    typedef std::allocator_traits<A> AT;
+    A a;
+    test_max<T> (AT::max_size(a) + 1);             // just barely too large
+    test_max<T> (AT::max_size(a) * 2);             // significantly too large
     test_max<T> (((size_t) -1) / sizeof(T) + 1);   // multiply will overflow
     test_max<T> ((size_t) -1);                     // way too large
 }

diff  --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
index 0bff67efbd9c..26feeedf85de 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
@@ -14,16 +14,10 @@
 // class allocator
 // {
 // public:
-//     typedef size_t                                size_type;
-//     typedef ptr
diff _t                             
diff erence_type;
-//     typedef T*                                    pointer;
-//     typedef const T*                              const_pointer;
-//     typedef typename add_lvalue_reference<T>::type       reference;
-//     typedef typename add_lvalue_reference<const T>::type const_reference;
-//     typedef T                                     value_type;
-//     typedef true_type                             is_always_equal;
+//     typedef T         value_type;
 //
-//     template <class U> struct rebind {typedef allocator<U> other;};
+//     typedef true_type propagate_on_container_move_assignment;
+//     typedef true_type is_always_equal;
 // ...
 // };
 
@@ -35,17 +29,12 @@
 
 int main(int, char**)
 {
-    static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
-    static_assert((std::is_same<std::allocator<char>::
diff erence_type, std::ptr
diff _t>::value), "");
-    static_assert((std::is_same<std::allocator<char>::pointer, char*>::value), "");
-    static_assert((std::is_same<std::allocator<char>::const_pointer, const char*>::value), "");
     static_assert((std::is_same<std::allocator<char>::value_type, char>::value), "");
-    static_assert((std::is_same<std::allocator<char>::reference, char&>::value), "");
-    static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
-    static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
-                                std::allocator<int> >::value), "");
 
-    static_assert((std::is_same<std::allocator<      char>::is_always_equal, std::true_type>::value), "");
+    static_assert((std::is_same<std::allocator<char>::propagate_on_container_move_assignment, std::true_type>::value), "");
+    LIBCPP_STATIC_ASSERT((std::is_same<std::allocator<const char>::propagate_on_container_move_assignment, std::true_type>::value), "");
+
+    static_assert((std::is_same<std::allocator<char>::is_always_equal, std::true_type>::value), "");
     LIBCPP_STATIC_ASSERT((std::is_same<std::allocator<const char>::is_always_equal, std::true_type>::value), "");
 
     std::allocator<char> a;

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
index 973aa93df3cc..0b736f591412 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp
@@ -86,7 +86,7 @@ void compile_tests() {
 }
 
 void allocator_tests() {
-    std::allocator<void> alloc;
+    std::allocator<int> alloc;
     int x = 42;
     {
         std::tuple<int&> t(std::ref(x));

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
index 7376a38c9b6a..728b1ee0dea5 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR23256_constrain_UTypes_ctor.pass.cpp
@@ -71,22 +71,22 @@ int main(int, char**) {
     {
         static_assert(std::is_constructible<
             std::tuple<A>,
-            std::allocator_arg_t, std::allocator<void>,
+            std::allocator_arg_t, std::allocator<int>,
             std::tuple<A> const&
         >::value, "");
         static_assert(std::is_constructible<
             std::tuple<A>,
-            std::allocator_arg_t, std::allocator<void>,
+            std::allocator_arg_t, std::allocator<int>,
             std::tuple<A> &&
         >::value, "");
         static_assert(std::is_constructible<
             std::tuple<ExplicitA>,
-            std::allocator_arg_t, std::allocator<void>,
+            std::allocator_arg_t, std::allocator<int>,
             std::tuple<ExplicitA> const&
         >::value, "");
         static_assert(std::is_constructible<
             std::tuple<ExplicitA>,
-            std::allocator_arg_t, std::allocator<void>,
+            std::allocator_arg_t, std::allocator<int>,
             std::tuple<ExplicitA> &&
         >::value, "");
     }

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
index 050a4b0d5d5b..9e19bcd1c207 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp
@@ -81,7 +81,7 @@ struct Explicit {
 int main(int, char**)
 {
     {
-        std::tuple<Explicit> t{std::allocator_arg, std::allocator<void>{}, 42};
+        std::tuple<Explicit> t{std::allocator_arg, std::allocator<int>{}, 42};
         assert(std::get<0>(t).value == 42);
     }
     {

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp
index 76f99e1978dd..364e815625f2 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.fail.cpp
@@ -26,13 +26,13 @@ struct ExplicitCopy {
 
 std::tuple<ExplicitCopy> const_explicit_copy_test() {
     const ExplicitCopy e(42);
-    return {std::allocator_arg, std::allocator<void>{}, e};
+    return {std::allocator_arg, std::allocator<int>{}, e};
     // expected-error at -1 {{chosen constructor is explicit in copy-initialization}}
 }
 
 std::tuple<ExplicitCopy> non_const_explicity_copy_test() {
     ExplicitCopy e(42);
-    return {std::allocator_arg, std::allocator<void>{}, e};
+    return {std::allocator_arg, std::allocator<int>{}, e};
     // expected-error at -1 {{chosen constructor is explicit in copy-initialization}}
 }
 int main(int, char**)

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp
index d1cd59600bd7..376308f07e2c 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_const_Types.pass.cpp
@@ -33,19 +33,19 @@ struct ImplicitCopy {
 // copy conversions in return value expressions.
 std::tuple<ImplicitCopy> testImplicitCopy1() {
     ImplicitCopy i(42);
-    return {std::allocator_arg, std::allocator<void>{}, i};
+    return {std::allocator_arg, std::allocator<int>{}, i};
 }
 
 std::tuple<ImplicitCopy> testImplicitCopy2() {
     const ImplicitCopy i(42);
-    return {std::allocator_arg, std::allocator<void>{}, i};
+    return {std::allocator_arg, std::allocator<int>{}, i};
 }
 
 int main(int, char**)
 {
     {
         // check that the literal '0' can implicitly initialize a stored pointer.
-        std::tuple<int*> t = {std::allocator_arg, std::allocator<void>{}, 0};
+        std::tuple<int*> t = {std::allocator_arg, std::allocator<int>{}, 0};
     }
     {
         std::tuple<int> t(std::allocator_arg, A1<int>(), 3);

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp
index ca9518d6b2bc..d5e5dbb22b4d 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.fail.cpp
@@ -26,13 +26,13 @@ struct ExplicitCopy {
 
 std::tuple<ExplicitCopy> const_explicit_copy_test() {
     const std::tuple<int> t1(42);
-    return {std::allocator_arg, std::allocator<void>{}, t1};
+    return {std::allocator_arg, std::allocator<int>{}, t1};
     // expected-error at -1 {{chosen constructor is explicit in copy-initialization}}
 }
 
 std::tuple<ExplicitCopy> non_const_explicit_copy_test() {
     std::tuple<int> t1(42);
-    return {std::allocator_arg, std::allocator<void>{}, t1};
+    return {std::allocator_arg, std::allocator<int>{}, t1};
     // expected-error at -1 {{chosen constructor is explicit in copy-initialization}}
 }
 

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
index 86989a8fb15d..5d80c6c5da2d 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_copy.pass.cpp
@@ -79,12 +79,12 @@ int main(int, char**)
     }
     {
         const std::tuple<int> t1(42);
-        std::tuple<Explicit> t2{std::allocator_arg, std::allocator<void>{},  t1};
+        std::tuple<Explicit> t2{std::allocator_arg, std::allocator<int>{},  t1};
         assert(std::get<0>(t2).value == 42);
     }
     {
         const std::tuple<int> t1(42);
-        std::tuple<Implicit> t2 = {std::allocator_arg, std::allocator<void>{}, t1};
+        std::tuple<Implicit> t2 = {std::allocator_arg, std::allocator<int>{}, t1};
         assert(std::get<0>(t2).value == 42);
     }
 

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp
index 7a2a5ffff5de..130d61a1dc7f 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.fail.cpp
@@ -25,7 +25,7 @@ struct ExplicitCopy {
 
 std::tuple<ExplicitCopy> explicit_move_test() {
     std::tuple<int> t1(42);
-    return {std::allocator_arg, std::allocator<void>{}, std::move(t1)};
+    return {std::allocator_arg, std::allocator<int>{}, std::move(t1)};
     // expected-error at -1 {{chosen constructor is explicit in copy-initialization}}
 }
 

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp
index 6973616a53a3..e2128097c5c4 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_convert_move.pass.cpp
@@ -93,12 +93,12 @@ int main(int, char**)
     }
     {
         std::tuple<int> t1(42);
-        std::tuple<Explicit> t2{std::allocator_arg, std::allocator<void>{}, std::move(t1)};
+        std::tuple<Explicit> t2{std::allocator_arg, std::allocator<int>{}, std::move(t1)};
         assert(std::get<0>(t2).value == 42);
     }
     {
         std::tuple<int> t1(42);
-        std::tuple<Implicit> t2 = {std::allocator_arg, std::allocator<void>{}, std::move(t1)};
+        std::tuple<Implicit> t2 = {std::allocator_arg, std::allocator<int>{}, std::move(t1)};
         assert(std::get<0>(t2).value == 42);
     }
 

diff  --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
index c298c4e45bfb..15051333c0cf 100644
--- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
+++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/move.pass.cpp
@@ -51,7 +51,7 @@ struct move_only_large final {
 template <class Elem>
 void test_sfinae() {
     using Tup = std::tuple<Elem>;
-    using Alloc = std::allocator<void>;
+    using Alloc = std::allocator<int>;
     using Tag = std::allocator_arg_t;
     // special members
     {


        


More information about the libcxx-commits mailing list