public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Fix up implementation of LWG 3533 [PR101589]
@ 2021-07-23 16:34 Patrick Palka
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Palka @ 2021-07-23 16:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

In r12-569 I accidentally applied the LWG 3533 change that
was intended for elements_view::iterator::base to
elements_view::base instead.

This patch corrects this, and also applies the corresponding LWG 3533
change to lazy_split_view::inner-iter::base now that we implement P2210.

Tested on x86_64-pc-linux-gnu, does this look OK for trunk and release
branches?

	PR libstdc++/101589

libstdc++-v3/ChangeLog:

	* include/std/ranges (lazy_split_view::_InnerIter::base): Make
	the const& overload unconstrained and return a const reference
	as per LWG 3533.  Make unconditionally noexcept.
	(elements_view::base): Revert accidental r12-569 change.
	(elements_view::_Iterator::base): Make the const& overload
	unconstrained and return a const reference as per LWG 3533.
	Make unconditionally noexcept.
---
 libstdc++-v3/include/std/ranges | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index d791e15d096..50b414e8c8c 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -3103,8 +3103,8 @@ namespace views::__adaptor
 	    : _M_i(std::move(__i))
 	  { }
 
-	  constexpr iterator_t<_Base>
-	  base() const& requires copyable<iterator_t<_Base>>
+	  constexpr const iterator_t<_Base>&
+	  base() const& noexcept
 	  { return _M_i_current(); }
 
 	  constexpr iterator_t<_Base>
@@ -3786,8 +3786,8 @@ namespace views::__adaptor
 	: _M_base(std::move(base))
       { }
 
-      constexpr const _Vp&
-      base() const & noexcept
+      constexpr _Vp
+      base() const& requires copy_constructible<_Vp>
       { return _M_base; }
 
       constexpr _Vp
@@ -3913,9 +3913,8 @@ namespace views::__adaptor
 	    : _M_current(std::move(i._M_current))
 	  { }
 
-	  constexpr iterator_t<_Base>
-	  base() const&
-	    requires copyable<iterator_t<_Base>>
+	  constexpr const iterator_t<_Base>&
+	  base() const& noexcept
 	  { return _M_current; }
 
 	  constexpr iterator_t<_Base>
-- 
2.32.0.349.gdaab8a564f


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++: Fix up implementation of LWG 3533 [PR101589]
  2021-07-23 16:34 Patrick Palka
@ 2021-07-26  9:48 ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2021-07-26  9:48 UTC (permalink / raw)
  To: Patrick Palka; +Cc: gcc Patches, libstdc++

On Fri, 23 Jul 2021 at 17:35, Patrick Palka via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> In r12-569 I accidentally applied the LWG 3533 change that
> was intended for elements_view::iterator::base to
> elements_view::base instead.
>
> This patch corrects this, and also applies the corresponding LWG 3533
> change to lazy_split_view::inner-iter::base now that we implement P2210.
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk and release
> branches?

OK, thanks.


>
>         PR libstdc++/101589
>
> libstdc++-v3/ChangeLog:
>
>         * include/std/ranges (lazy_split_view::_InnerIter::base): Make
>         the const& overload unconstrained and return a const reference
>         as per LWG 3533.  Make unconditionally noexcept.
>         (elements_view::base): Revert accidental r12-569 change.
>         (elements_view::_Iterator::base): Make the const& overload
>         unconstrained and return a const reference as per LWG 3533.
>         Make unconditionally noexcept.
> ---
>  libstdc++-v3/include/std/ranges | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
> index d791e15d096..50b414e8c8c 100644
> --- a/libstdc++-v3/include/std/ranges
> +++ b/libstdc++-v3/include/std/ranges
> @@ -3103,8 +3103,8 @@ namespace views::__adaptor
>             : _M_i(std::move(__i))
>           { }
>
> -         constexpr iterator_t<_Base>
> -         base() const& requires copyable<iterator_t<_Base>>
> +         constexpr const iterator_t<_Base>&
> +         base() const& noexcept
>           { return _M_i_current(); }
>
>           constexpr iterator_t<_Base>
> @@ -3786,8 +3786,8 @@ namespace views::__adaptor
>         : _M_base(std::move(base))
>        { }
>
> -      constexpr const _Vp&
> -      base() const & noexcept
> +      constexpr _Vp
> +      base() const& requires copy_constructible<_Vp>
>        { return _M_base; }
>
>        constexpr _Vp
> @@ -3913,9 +3913,8 @@ namespace views::__adaptor
>             : _M_current(std::move(i._M_current))
>           { }
>
> -         constexpr iterator_t<_Base>
> -         base() const&
> -           requires copyable<iterator_t<_Base>>
> +         constexpr const iterator_t<_Base>&
> +         base() const& noexcept
>           { return _M_current; }
>
>           constexpr iterator_t<_Base>
> --
> 2.32.0.349.gdaab8a564f
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] libstdc++: Fix up implementation of LWG 3533 [PR101589]
@ 2021-07-23 16:34 Patrick Palka
  2021-07-26  9:48 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Palka @ 2021-07-23 16:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Patrick Palka

In r12-569 I accidentally applied the LWG 3533 change that
was intended for elements_view::iterator::base to
elements_view::base instead.

This patch corrects this, and also applies the corresponding LWG 3533
change to lazy_split_view::inner-iter::base now that we implement P2210.

Tested on x86_64-pc-linux-gnu, does this look OK for trunk and release
branches?

	PR libstdc++/101589

libstdc++-v3/ChangeLog:

	* include/std/ranges (lazy_split_view::_InnerIter::base): Make
	the const& overload unconstrained and return a const reference
	as per LWG 3533.  Make unconditionally noexcept.
	(elements_view::base): Revert accidental r12-569 change.
	(elements_view::_Iterator::base): Make the const& overload
	unconstrained and return a const reference as per LWG 3533.
	Make unconditionally noexcept.
---
 libstdc++-v3/include/std/ranges | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index d791e15d096..50b414e8c8c 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -3103,8 +3103,8 @@ namespace views::__adaptor
 	    : _M_i(std::move(__i))
 	  { }
 
-	  constexpr iterator_t<_Base>
-	  base() const& requires copyable<iterator_t<_Base>>
+	  constexpr const iterator_t<_Base>&
+	  base() const& noexcept
 	  { return _M_i_current(); }
 
 	  constexpr iterator_t<_Base>
@@ -3786,8 +3786,8 @@ namespace views::__adaptor
 	: _M_base(std::move(base))
       { }
 
-      constexpr const _Vp&
-      base() const & noexcept
+      constexpr _Vp
+      base() const& requires copy_constructible<_Vp>
       { return _M_base; }
 
       constexpr _Vp
@@ -3913,9 +3913,8 @@ namespace views::__adaptor
 	    : _M_current(std::move(i._M_current))
 	  { }
 
-	  constexpr iterator_t<_Base>
-	  base() const&
-	    requires copyable<iterator_t<_Base>>
+	  constexpr const iterator_t<_Base>&
+	  base() const& noexcept
 	  { return _M_current; }
 
 	  constexpr iterator_t<_Base>
-- 
2.32.0.349.gdaab8a564f


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-26  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 16:34 [PATCH] libstdc++: Fix up implementation of LWG 3533 [PR101589] Patrick Palka
  -- strict thread matches above, loose matches on Subject: below --
2021-07-23 16:34 Patrick Palka
2021-07-26  9:48 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).