diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -499,6 +499,9 @@ "internal allocator type must differ from user-specified " "type; otherwise overload resolution breaks"); + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + __compressed_pair<__begin_node, __node_allocator> __before_begin_; _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -847,6 +847,9 @@ typedef void __remove_return_type; #endif + static_assert(is_same, value_type> >::value, + "rebinding an allocator to the same type should result in the original allocator"); + _LIBCPP_INLINE_VISIBILITY list() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value) diff --git a/libcxx/include/map b/libcxx/include/map --- a/libcxx/include/map +++ b/libcxx/include/map @@ -1004,6 +1004,9 @@ typedef typename __base::__node_traits __node_traits; typedef allocator_traits __alloc_traits; + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + __base __tree_; public: @@ -1781,6 +1784,9 @@ typedef typename __base::__node_traits __node_traits; typedef allocator_traits __alloc_traits; + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + __base __tree_; public: diff --git a/libcxx/include/set b/libcxx/include/set --- a/libcxx/include/set +++ b/libcxx/include/set @@ -530,6 +530,9 @@ typedef __tree __base; typedef allocator_traits __alloc_traits; + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + __base __tree_; public: @@ -1063,6 +1066,9 @@ typedef __tree __base; typedef allocator_traits __alloc_traits; + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + __base __tree_; public: diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -685,6 +685,9 @@ static_assert(( is_same::value), "Allocator::value_type must be same type as value_type"); + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + typedef __wrap_iter iterator; typedef __wrap_iter const_iterator; typedef std::reverse_iterator reverse_iterator; diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1058,6 +1058,9 @@ typedef unique_ptr<__node, _Dp> __node_holder; typedef allocator_traits __alloc_traits; + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + static_assert((is_same::value), ""); static_assert((is_same::value), ""); public: @@ -1948,6 +1951,10 @@ static_assert((is_same::value), "Allocator uses different size_type for different types"); + + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + public: typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -514,6 +514,9 @@ static_assert((is_same::value), "Invalid allocator::value_type"); + static_assert(is_same, value_type> >::value, + "rebinding an allocator to the same type should result in the original allocator"); + private: typedef __hash_table __table; diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -357,6 +357,9 @@ static_assert((is_same::value), "Allocator::value_type must be same type as value_type"); + static_assert(is_same >::value, + "rebinding an allocator to the same type should result in the original allocator"); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector() _NOEXCEPT_(is_nothrow_default_constructible::value) {