public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>,
	"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++: missing constexpr for __[nm]iter_base [PR102358]
Date: Thu, 21 Oct 2021 16:02:06 +0100	[thread overview]
Message-ID: <CACb0b4nprUN2B01Y1LnHRWajMGPU4ck2kGU7T2iS2ARKWcz+yw@mail.gmail.com> (raw)
In-Reply-To: <20211021143655.2107584-1-ppalka@redhat.com>

On Thu, 21 Oct 2021 at 15:38, Patrick Palka via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:

> Tested on x86_64-pc-linux-gnu, does this look ok for trunk/11/10?
>

Yes to all, thanks.



>         PR libstdc++/102358
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/stl_iterator.h (__niter_base): Make constexpr
>         for C++20.
>         (__miter_base): Likewise.
>         * testsuite/25_algorithms/move/constexpr.cc: New test.
> ---
>  libstdc++-v3/include/bits/stl_iterator.h      |  2 ++
>  .../testsuite/25_algorithms/move/constexpr.cc | 19 +++++++++++++++++++
>  2 files changed, 21 insertions(+)
>  create mode 100644 libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc
>
> diff --git a/libstdc++-v3/include/bits/stl_iterator.h
> b/libstdc++-v3/include/bits/stl_iterator.h
> index 8afd6756613..fbd91956ced 100644
> --- a/libstdc++-v3/include/bits/stl_iterator.h
> +++ b/libstdc++-v3/include/bits/stl_iterator.h
> @@ -2470,6 +2470,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    /// @} group iterators
>
>    template<typename _Iterator>
> +    _GLIBCXX20_CONSTEXPR
>      auto
>      __niter_base(move_iterator<_Iterator> __it)
>      -> decltype(make_move_iterator(__niter_base(__it.base())))
> @@ -2483,6 +2484,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      };
>
>    template<typename _Iterator>
> +    _GLIBCXX20_CONSTEXPR
>      auto
>      __miter_base(move_iterator<_Iterator> __it)
>      -> decltype(__miter_base(__it.base()))
> diff --git a/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc
> b/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc
> new file mode 100644
> index 00000000000..773c55cfb50
> --- /dev/null
> +++ b/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc
> @@ -0,0 +1,19 @@
> +// { dg-options "-std=gnu++20" }
> +// { dg-do compile { target c++20 } }
> +
> +#include <algorithm>
> +#include <span>
> +
> +constexpr bool
> +test01()
> +{
> +  // PR libstdc++/102358
> +  int x[2] = {1,2}, y[2];
> +  std::span in(x), out(y);
> +  std::move(std::move_iterator(in.begin()), std::move_iterator(in.end()),
> +           out.begin());
> +  return std::equal(std::move_iterator(in.begin()),
> std::move_iterator(in.end()),
> +                   std::move_iterator(out.begin()));
> +}
> +
> +static_assert(test01());
> --
> 2.33.1.711.g9d530dc002
>
>

      reply	other threads:[~2021-10-21 15:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 14:36 Patrick Palka
2021-10-21 15:02 ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACb0b4nprUN2B01Y1LnHRWajMGPU4ck2kGU7T2iS2ARKWcz+yw@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ppalka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).