diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2014-09-16 20:38:11 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2014-09-16 20:38:11 +0000 |
commit | f1e473bad91ade08503be6549c2cb4f229835327 (patch) | |
tree | 7b7daa933b6521e1587377860b9eb3190303ce46 /libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp | |
parent | ed35a3e7171fe61ddd9e84d84332c9a8c4470056 (diff) | |
download | bcm5719-llvm-f1e473bad91ade08503be6549c2cb4f229835327.tar.gz bcm5719-llvm-f1e473bad91ade08503be6549c2cb4f229835327.zip |
Create a 'comma_iterator' class that overloads operator, and asserts when it's called. Add tests to mismatch to make sure it can't be blindsided by such an evil iterator. More tests for other algorithms forthcoming. Thanks to STL for pointing this out at CppCon and Yakov Galka for opening LWG issue #2133
llvm-svn: 217902
Diffstat (limited to 'libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp')
-rw-r--r-- | libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp b/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp index fe678541382..78f795afae4 100644 --- a/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp +++ b/libcxx/test/algorithms/alg.nonmodifying/mismatch/mismatch.pass.cpp @@ -36,6 +36,14 @@ int main() input_iterator<const int*>(ia+3), input_iterator<const int*>(ib+3)))); + assert(std::mismatch(comma_iterator<const int*>(ia), + comma_iterator<const int*>(ia + sa), + comma_iterator<const int*>(ib)) == + (std::pair<comma_iterator<const int*>, + comma_iterator<const int*> >( + comma_iterator<const int*>(ia+3), + comma_iterator<const int*>(ib+3)))); + #ifdef HAS_FOUR_ITERATOR_VERSION assert(std::mismatch(input_iterator<const int*>(ia), input_iterator<const int*>(ia + sa), |