diff --git a/include/vector b/include/vector index 11d9a1b6d..a083bfe09 100644 --- a/include/vector +++ b/include/vector @@ -502,6 +502,9 @@ public: typedef _VSTD::reverse_iterator reverse_iterator; typedef _VSTD::reverse_iterator const_reverse_iterator; + static_assert((is_same::value), + "Allocator::value_type must be same type as value_type"); + _LIBCPP_INLINE_VISIBILITY vector() _NOEXCEPT_(is_nothrow_default_constructible::value) diff --git a/test/containers/sequences/vector/vector.cons/move.pass.cpp b/test/containers/sequences/vector/vector.cons/move.pass.cpp index 8d85fd939..b0364058e 100644 --- a/test/containers/sequences/vector/vector.cons/move.pass.cpp +++ b/test/containers/sequences/vector/vector.cons/move.pass.cpp @@ -45,5 +45,13 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } + { + int a1[] = {1, 3, 7, 9, 10}; + std::vector c1(a1, a1+sizeof(a1)/sizeof(a1[0])); + std::vector::const_iterator i = c1.begin(); + std::vector c2 = std::move(c1); + std::vector::iterator j = c2.erase(i); + assert(*j == 3); + } #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }