libstdc++: Fix concept checks for iterators
authorJonathan Wakely <jwakely@redhat.com>
Fri, 24 Sep 2021 12:56:33 +0000 (13:56 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 28 Sep 2021 19:22:51 +0000 (20:22 +0100)
commitafffc96a5259ba4e3f3cca154dc5ea32a496875e
treecbced4b89016672b840a05dbc918aab7d1eb7575
parent5f1db7627f6eea2050c3d71f17bca5ecf586a813
libstdc++: Fix concept checks for iterators

This adds some additional checks the the C++98-style concept checks for
iterators, and removes some bogus checks for mutable iterators. Instead
of requiring that the result of dereferencing a mutable iterator is
assignable (which is a property of the value type, not required for the
iterator) check that the reference type is a non-const reference to the
value type.

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

* include/bits/boost_concept_check.h (_ForwardIteratorConcept)
(_BidirectionalIteratorConcept, _RandomAccessIteratorConcept):
Check result types of iterator operations.
(_Mutable_ForwardIteratorConcept): Check that iterator's
reference type is a reference to its value type.
(_Mutable_BidirectionalIteratorConcept): Do not require the
value type to be assignable.
(_Mutable_RandomAccessIteratorConcept): Likewise.
* testsuite/24_iterators/operations/prev_neg.cc: Adjust dg-error
line number.
libstdc++-v3/include/bits/boost_concept_check.h
libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc