From 2c6374228bc0aef10b89e5dd9131dbf99477f753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dumont?= Date: Sun, 6 Oct 2019 10:29:35 +0000 Subject: Add std::copy_n __glibcxx_requires_can_increment checks. * include/bits/stl_algo.h (copy_n): Add __glibcxx_requires_can_increment debug checks. * testsuite/25_algorithms/copy_n/debug/1_neg.cc: New. * testsuite/25_algorithms/copy_n/debug/2_neg.cc: New. From-SVN: r276636 --- libstdc++-v3/include/bits/stl_algo.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libstdc++-v3/include') diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index b326c63..6dd01e1 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -826,6 +826,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_can_increment(__first, __n); + __glibcxx_requires_can_increment(__result, __n); return std::__copy_n(__first, __n, __result, std::__iterator_category(__first)); -- cgit v1.1