Message ID | 20200310114027.GA3370377@redhat.com |
---|---|
State | New |
Headers | show |
Series | [committed] libstdc++: Fix invalid noexcept-specifier (PR 94117) | expand |
On 10/03/20 11:40 +0000, Jonathan Wakely wrote: >G++ fails to diagnose this non-dependent expression, but Clang doesn't >like it. > > PR c++/94117 > * include/std/ranges (ranges::transform_view::_Iterator::iter_move): > Change expression in noexcept-specifier to match function body. > This patch goes further and removes the __iter_move helper completely, and the __iter_swap one, in transform_view. It also does the same in split_view, and fixes a bug where the noexcept-specifier was always false. I've also added new _M_i_current() accessors (overloaded for const and non-const) to return _M_i.__current(). Using this instead of _M_i._M_current fixes a bug in inner-iterator::operator*() (which is also present in the working draft). Tested powerpc64le-linux, committed to master.
On 10/03/20 17:52 +0000, Jonathan Wakely wrote: >On 10/03/20 11:40 +0000, Jonathan Wakely wrote: >>G++ fails to diagnose this non-dependent expression, but Clang doesn't >>like it. >> >> PR c++/94117 >> * include/std/ranges (ranges::transform_view::_Iterator::iter_move): >> Change expression in noexcept-specifier to match function body. >> > > >This patch goes further and removes the __iter_move helper completely, >and the __iter_swap one, in transform_view. > >It also does the same in split_view, and fixes a bug where the >noexcept-specifier was always false. > >I've also added new _M_i_current() accessors (overloaded for const and >non-const) to return _M_i.__current(). Using this instead of >_M_i._M_current fixes a bug in inner-iterator::operator*() (which is >also present in the working draft). I missed a few more bugs in the outer iterator, where _M_current was being used directly despite only being valid for forward ranges. Fixed by this patch. Tested powerpc64le-linux, committed to master.
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index eb54b110c04..292132db990 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -1837,7 +1837,7 @@ namespace views { return __x._M_current - __y._M_current; } friend constexpr decltype(auto) - iter_move(const _Iterator& __i) noexcept(noexcept(__iter_move())) + iter_move(const _Iterator& __i) noexcept(noexcept(__iter_move(__i))) { return __iter_move(__i); } friend constexpr void