Noticed that std::allocator<const T> was missing the definition for is_always_equal. Fixed this, and added a test for it.
llvm-svn: 241190
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: f43a42d53e21e5860217ede634f8eea6d25d3a18
diff --git a/include/memory b/include/memory
index 69702c6..26ba564 100644
--- a/include/memory
+++ b/include/memory
@@ -1787,6 +1787,7 @@
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;};
diff --git a/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp b/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
index 927736c..31a0f17 100644
--- a/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
+++ b/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
@@ -45,4 +45,8 @@
static_assert((std::is_same<std::allocator_traits<A<char> >::is_always_equal, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::is_always_equal, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::is_always_equal, std::false_type>::value), "");
+
+ static_assert((std::is_same<std::allocator_traits<A<const char> >::is_always_equal, std::true_type>::value), "");
+ static_assert((std::is_same<std::allocator_traits<B<const char> >::is_always_equal, std::true_type>::value), "");
+ static_assert((std::is_same<std::allocator_traits<C<const char> >::is_always_equal, std::false_type>::value), "");
}
diff --git a/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp b/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
index db08123..cba3210 100644
--- a/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
+++ b/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
@@ -22,6 +22,7 @@
// 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;
//
// template <class U> struct rebind {typedef allocator<U> other;};
// ...
@@ -42,6 +43,10 @@
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<const char>::is_always_equal, std::true_type>::value), "");
+
std::allocator<char> a;
std::allocator<char> a2 = a;
a2 = a;