From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 2419D3858436 for ; Thu, 21 Oct 2021 15:02:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2419D3858436 Received: from mail-ua1-f70.google.com (mail-ua1-f70.google.com [209.85.222.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-uFemJbBXOdWwPnSo9mmjdQ-1; Thu, 21 Oct 2021 11:02:19 -0400 X-MC-Unique: uFemJbBXOdWwPnSo9mmjdQ-1 Received: by mail-ua1-f70.google.com with SMTP id o4-20020ab05944000000b002c9c4d839d1so370877uad.13 for ; Thu, 21 Oct 2021 08:02:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v3ZY7kvleBmoYlWYJlqT+hXesUkGhpLe/quoZYFjj3c=; b=c/CftL8vdfuvX/TKrrFs7a5h210U1EX1bsNzByHtgVQoNN+z2ryg0t5F1oIxxRTF96 ZZYo16KXUF5wvRXYjrCiAQWsMmHz/WoMYgYTLkLtHOYnM1w2lZ4DS5Hg6+nz7EFV7vIa L18VPpyvZbXYzeczXwM5q5vzpm2LlUB5fS7OK7lqmzNkh6eUl7ZhESr+0+C/69NiXBL1 rHbvZ7stucIKM3jWVzQNmE7qHK+NaeeCXr+CcMaccADfCQQ27oPgxzFOQUWt59WUtFVl hY4Zs5VkpnKn5VDjiShIpCNF886b/tRof/B8KaVlpl6+WrBQOgPoJF2T4dJfISlj2bKX Bnzg== X-Gm-Message-State: AOAM530mbo9IciKOnqSmHvBl5v8jZcwS7V7BEqS2gyl/RG1lCccpUn4Q rKonrkGoTwzC2/VNroyoyp5x7Iq/3U51tB4+8PHwf7PcBlbvOIuM8APlljtOLooxsn1OvSl1LG7 Hrsdxt9njHy0aXbeaqi2B81Hyr4cm79o= X-Received: by 2002:a67:1c04:: with SMTP id c4mr6503457vsc.11.1634828539259; Thu, 21 Oct 2021 08:02:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG+XwStPBAJKKyJQtf8LNTfXu7qoMP8PypDOzjwkDrzRaGHYtbVQQ6cSGz6PujRYiiJVjIip6yWRjXnV+gxBQ= X-Received: by 2002:a67:1c04:: with SMTP id c4mr6503301vsc.11.1634828537951; Thu, 21 Oct 2021 08:02:17 -0700 (PDT) MIME-Version: 1.0 References: <20211021143655.2107584-1-ppalka@redhat.com> In-Reply-To: <20211021143655.2107584-1-ppalka@redhat.com> From: Jonathan Wakely Date: Thu, 21 Oct 2021 16:02:06 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: missing constexpr for __[nm]iter_base [PR102358] To: Patrick Palka Cc: gcc Patches , "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2021 15:02:28 -0000 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 > + _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 > + _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 > +#include > + > +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 > >