On 23/03/21 18:45 +0100, Moritz Sichert via Libstdc++ wrote:
Thank you!
You are right. The idea was that the test also tests the const overloads of
begin() and end() of reverse_view. But the view concept requires movable.
Maybe, this should just be
static_assert(std::ranges::range<const decltype(v)>);
instead?
Oops, I mean to delete the second line, not just the 'const' keyword.
But checking that it models range is better.
Also the comment is slightly wrong, it won't call
make_reserve_iterator(const A&) it will call make_reserve_iterator(A*)
or make_reserve_iterator(const A*).
I've committed the attached patch. Thanks again.
commit d1aa5f57db7c14a62e9b7e2a2aa8a9c402a89363
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Tue Mar 23 18:22:18 2021
libstdc++: Improve test for views::reverse
libstdc++-v3/ChangeLog:
* testsuite/std/ranges/adaptors/reverse.cc: Replace duplicated
line with a check that uses the const being/end overloads.
diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc
index 47386575192..0d52498e207 100644
--- a/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc
+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/reverse.cc
@@ -141,11 +141,12 @@ namespace test_ns
void test06()
{
// Check that views::reverse works and does not use ADL which could lead
- // to accidentally finding test_ns::make_reverse_iterator(const A&).
+ // to accidentally finding test_ns::make_reverse_iterator(A*).
test_ns::A as[] = {{}, {}};
auto v = as | std::views::reverse;
- static_assert(std::ranges::view<decltype(v)>);
- static_assert(std::ranges::view<decltype(v)>);
+ using V = decltype(v);
+ static_assert( std::ranges::view<V> );
+ static_assert( std::ranges::range<const V> );
}
int