From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4281B3857001; Thu, 2 Sep 2021 20:28:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4281B3857001 From: "raffael at casagrande dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/102181] New: std::advance and std::views::iota don't work Date: Thu, 02 Sep 2021 20:28:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: raffael at casagrande dot ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2021 20:28:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102181 Bug ID: 102181 Summary: std::advance and std::views::iota don't work Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: raffael at casagrande dot ch Target Milestone: --- The following simple program doesn't compile: #include int main() { using type =3D std::int64_t; // using type =3D int works! auto v =3D std::ranges::iota_view(static_cast(0), static_cast(100)); auto b =3D v.begin(); std::advance(b, static_cast(1)); } gcc version: 12.0.0 20210901 (experimental) Error messages: /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h: In instantiation of 'constexpr void std::advance(_InputIterator&, _Distance) [with _InputIterator =3D std::ranges::iota_view::_Itera= tor; _Distance =3D long int]': :7:15: required from here /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:207:21: error: no matching function for call to '__advance(std::ranges::iota_view::_Iterator&, std::__iterator_traits::_Iterator, void>::difference_type&, std::__iterator_traits::_Iterato= r, void>::iterator_category)' 207 | std::__advance(__i, __d, std::__iterator_category(__i)); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:148:5: note: candidate: 'template constexpr void std::__advance(_InputIterator&, _Distance, std::input_iterator_tag)' 148 | __advance(_InputIterator& __i, _Distance __n, input_iterator_ta= g) | ^~~~~~~~~ /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:148:5: note: template argument deduction/substitution failed: /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:207:56: note: cannot convert 'std::__iterator_category::_Iterator>((*(const std::ranges::iota_view::_Iterator*)(& __i)))' (type 'std::__iterator_traits::_Iterat= or, void>::iterator_category' {aka 'std::output_iterator_tag'}) to type 'std::input_iterator_tag' 207 | std::__advance(__i, __d, std::__iterator_category(__i)); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:159:5: note: candidate: 'template constexpr void std::__advance(_BidirectionalIterator&, _Distance, std::bidirectional_iterator_tag)' 159 | __advance(_BidirectionalIterator& __i, _Distance __n, | ^~~~~~~~~ /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:159:5: note: template argument deduction/substitution failed: /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:207:56: note: cannot convert 'std::__iterator_category::_Iterator>((*(const std::ranges::iota_view::_Iterator*)(& __i)))' (type 'std::__iterator_traits::_Iterat= or, void>::iterator_category' {aka 'std::output_iterator_tag'}) to type 'std::bidirectional_iterator_tag' 207 | std::__advance(__i, __d, std::__iterator_category(__i)); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:175:5: note: candidate: 'template constexpr void std::__advance(_RandomAccessIterator&, _Distance, std::random_access_iterator_tag)' 175 | __advance(_RandomAccessIterator& __i, _Distance __n, | ^~~~~~~~~ /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:175:5: note: template argument deduction/substitution failed: /opt/compiler-explorer/gcc-trunk-20210902/include/c++/12.0.0/bits/stl_itera= tor_base_funcs.h:207:56: note: cannot convert 'std::__iterator_category::_Iterator>((*(const std::ranges::iota_view::_Iterator*)(& __i)))' (type 'std::__iterator_traits::_Iterat= or, void>::iterator_category' {aka 'std::output_iterator_tag'}) to type 'std::random_access_iterator_tag' 207 | std::__advance(__i, __d, std::__iterator_category(__i)); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~=