diff mbox series

[committed] libstdc++: Fix invalid noexcept-specifier (PR 94117)

Message ID 20200310114027.GA3370377@redhat.com
State New
Headers show
Series [committed] libstdc++: Fix invalid noexcept-specifier (PR 94117) | expand

Commit Message

Jonathan Wakely March 10, 2020, 11:40 a.m. UTC
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.

Tested x86_64-linux, committed to master.
commit c222eabcf8be0e3f644e4bd4c3316b40dba4b514
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Mar 10 10:50:40 2020 +0000

    libstdc++: Fix invalid noexcept-specifier (PR 94117)
    
    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.

Comments

Li, Pan2 via Gcc-patches March 10, 2020, 5:52 p.m. UTC | #1
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.
Li, Pan2 via Gcc-patches March 10, 2020, 10:16 p.m. UTC | #2
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 mbox series

Patch

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