It seems that in practice std::sentinel_for<I, I> is always true, and so the
test_range container doesn't help us detect bugs in ranges code in which we
wrongly assume that a sentinel can be manipulated like an iterator. Make the
test_range container more strict by having end() unconditionally return a
sentinel<I>.
Is this OK to commit after bootstrap+regtesting succeeds on x86_64-pc-linux-gnu?
libstdc++-v3/ChangeLog:
* testsuite/util/testsuite_iterators.h (__gnu_test::test_range::end):
Always return a sentinel<I>.
---
libstdc++-v3/testsuite/util/testsuite_iterators.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h
b/libstdc++-v3/testsuite/util/testsuite_iterators.h
index eb15257bf6a..6667a3af93a 100644
--- a/libstdc++-v3/testsuite/util/testsuite_iterators.h
+++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h
@@ -702,10 +702,7 @@ namespace __gnu_test
auto end() &
{
using I = decltype(get_iterator(bounds.last));
- if constexpr (std::sentinel_for<I, I>)
- return get_iterator(bounds.last);
- else
- return sentinel<I>{bounds.last};
+ return sentinel<I>{bounds.last};
}
typename Iter<T>::ContainerType bounds;
--
2.25.0.rc0