https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97935
Bug ID: 97935
Summary: Missing subsumption in iterator category detection
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: rs2740 at gmail dot com
Target Milestone: ---
In <bits/iterator_concepts.h>:
template<typename _Iter>
requires (!requires { typename _Iter::iterator_category; }
&& __detail::__cpp17_randacc_iterator<_Iter>)
struct __cat<_Iter>
{ using type = random_access_iterator_tag; };
template<typename _Iter>
requires (!requires { typename _Iter::iterator_category; }
&& __detail::__cpp17_bidi_iterator<_Iter>)
struct __cat<_Iter>
{ using type = bidirectional_iterator_tag; };
template<typename _Iter>
requires (!requires { typename _Iter::iterator_category; }
&& __detail::__cpp17_fwd_iterator<_Iter>)
struct __cat<_Iter>
{ using type = forward_iterator_tag; };
The !requires part of the constraints do not subsume each other, so any
iterator that is a __cpp17_bidi_iterator or stronger causes an ambiguity. It
needs to be extracted into a concept.