summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-03-26 19:04:56 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-03-26 19:04:56 +0000
commitcd4a9fd3017056d9316d29e1b3790404739ced4f (patch)
treefe394d090832acfddcb7b1e7802d05d51d3c9cca /libcxx
parentb13d21b6e17b2e34a33b35604a40b65bac43828c (diff)
downloadbcm5719-llvm-cd4a9fd3017056d9316d29e1b3790404739ced4f.tar.gz
bcm5719-llvm-cd4a9fd3017056d9316d29e1b3790404739ced4f.zip
Another vector debug mode test, and a static test on Allocator::value_type. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=15576.
llvm-svn: 178064
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/vector3
-rw-r--r--libcxx/test/containers/sequences/vector/vector.cons/move.pass.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 11d9a1b6d33..a083bfe09df 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -502,6 +502,9 @@ public:
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
_LIBCPP_INLINE_VISIBILITY
vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
diff --git a/libcxx/test/containers/sequences/vector/vector.cons/move.pass.cpp b/libcxx/test/containers/sequences/vector/vector.cons/move.pass.cpp
index 8d85fd9396d..b0364058eed 100644
--- a/libcxx/test/containers/sequences/vector/vector.cons/move.pass.cpp
+++ b/libcxx/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<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+ std::vector<int>::const_iterator i = c1.begin();
+ std::vector<int> c2 = std::move(c1);
+ std::vector<int>::iterator j = c2.erase(i);
+ assert(*j == 3);
+ }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
OpenPOWER on IntegriCloud