libstdc++: Make ranges CPOs final and not addressable
authorJonathan Wakely <jwakely@redhat.com>
Tue, 15 Jun 2021 16:54:53 +0000 (17:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 15 Jun 2021 17:20:06 +0000 (18:20 +0100)
commit8b93548778a487f31f21e0c6afe7e0bde9711fc4
tree7cef219dca5d79e16872fc66c0906f634c473c04
parent9245b0e84c262cc5fd8373e94de3d23a3807b122
libstdc++: Make ranges CPOs final and not addressable

This restricts the API of the CPOs and other function objects so they
cannot be misused by deriving from them or taking their addresses.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (ranges::begin, ranges::end)
(ranges::cbegin, ranges::cend, ranges::rbeing, ranges::rend)
(ranges::crbegin, ranges::crend, ranges::size, ranges::ssize)
(ranges::empty, ranges::data, ranges::cdata): Make types final.
Add deleted operator& overloads.
(ranges::advance, ranges::distance, ranges::next, ranges::prev):
Likewise.
* testsuite/std/ranges/headers/ranges/synopsis.cc: Replace
ill-formed & expressions with using-declarations. Add checks for
other function objects.
libstdc++-v3/include/bits/ranges_base.h
libstdc++-v3/testsuite/std/ranges/headers/ranges/synopsis.cc