aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-03-11 11:08:49 -0400
committerPatrick Palka <ppalka@redhat.com>2020-03-11 14:56:52 -0400
commit4512b7d85184c7131e98d29255e53cd2d913ddc2 (patch)
treeb38735150b7447dd1c41019a61b7193c8d1f0031 /libstdc++-v3/include
parent1c43ee69f4f6148fff4b5ace80d709d7f8b250d7 (diff)
downloadgcc-4512b7d85184c7131e98d29255e53cd2d913ddc2.zip
gcc-4512b7d85184c7131e98d29255e53cd2d913ddc2.tar.gz
gcc-4512b7d85184c7131e98d29255e53cd2d913ddc2.tar.bz2
libstdc++: Add a test that takes the split_view of a non-forward range
This adds a tests that verifies taking the split_view of a non-forward range works correctly. Doing so revealed a typo in one of _OuterIter's constructors. It also revealed that the default constructor of __gnu_test::test_range::iterator misbehaves, because by delegating to Iter<T>(nullptr, nullptr) we perform a null-pointer deref at runtime in input_iterator_wrapper's constructor due to the ITERATOR_VERIFY check therein. Instead of delegating to this constructor it seems we can just inherit the protected default constructor, which does not contain this ITERATOR_VERIFY check. libstdc++-v3/ChangeLog: * include/std/ranges (split_view::_OuterIter::_OuterIter): Typo fix, 'address' -> 'std::__addressof'. * testsuite/std/ranges/adaptors/split.cc: Test taking the split_view of a non-forward input_range. * testsuite/util/testsuite_iterators.h (output_iterator_wrapper): Make default constructor protected instead of deleted, like with input_iterator_wrapper. (test_range::iterator): Add comment explaining that this type is used only when the underlying wrapper is input_iterator_wrapper or output_iterator_wrapper. Remove delegating defaulted constructor so that the inherited default constructor is used instead.
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/std/ranges2
1 files changed, 1 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 5b06a9e..8f91598 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -2785,7 +2785,7 @@ namespace views
constexpr explicit
_OuterIter(_Parent& __parent) requires (!forward_range<_Base>)
- : _M_parent(address(__parent))
+ : _M_parent(std::__addressof(__parent))
{ }
constexpr