From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id 4191F3858C54; Sat, 18 Mar 2023 00:49:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4191F3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1033.google.com with SMTP id j13so7075364pjd.1; Fri, 17 Mar 2023 17:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679100581; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ICXkJ10WkcS5WlBSW2ClRFOZuii58m+dElafM4Omy8c=; b=HsoOLm1v7pcUrg6nuyW/Gi1sIR3NdhdwHwQ9GSqDaWUckT5D3Ny39ODhIxQrWYRyij pbB/ZxwjCuhpUm1dw3MQ+erK4SnFquyYxpjIXm4wysTjdUXVrgexggWs6snaQWUupTe3 /q5fuUtlra2fhpzjxodhE32xwidvUAfKOrQLe62nYz75dwns9vk9/9DOjGsrumtLm359 zEWxVIL6GdNnRocEd++sBpy2JbTqorPCBrEeOgGs7XQTckfDeEOorcPlk4f3QZUTav3G VMJI3YzTZRXTuQ/IU6X5vb8xkDAoFoDmwc+Wu2/82wXmi405/8OhSuFHxz10eSatOb0f FdDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679100581; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ICXkJ10WkcS5WlBSW2ClRFOZuii58m+dElafM4Omy8c=; b=q2A4mDKqUhY/3LNmEeC3TDeN8e3v6lOXbF8ChudFjyH/br27oL54oigD2FEU37utRS piVRyPEsXQf/efkxv+kEp+5jJFYrWflrYcOTs+8v7NlMArlhKRufZzgF5bmwhOci8ka0 WL1RLMjURhGBeM9viuslOkYZs8lc/4Wzl/x2CVnpMx0PVSrtO99FzmpZ1e1p/mlxn2A4 wd3G+v2Ptn1gkTwKoot7lHnuKFJPpRO0qu6LMLJ/ol3NwtwbsZ5aalVB3kJWORLvrv/O PtgmsZqxmHW9mwTOANh3jsDyO6lKWG2OsCw96jJIPRg75B7KtrmQVIntgoruqOXytEbO dGeA== X-Gm-Message-State: AO0yUKWxEM5RIzvoZNhFfvb3uarlVY40KtUAOnZZwQSzM7r8YsGUpqIU PErK8QN76eAX7+4IfT6Pqh2QS+0nY+Du6DVXKDM= X-Google-Smtp-Source: AK7set9le/BDjddnyuv2D5XktxHTzVnjpE93DV4Ad2SO5rU/WloiLsmoPq3mElRyUyRH/z78ElpSbW6+dwrZqHvP99M= X-Received: by 2002:a17:902:e749:b0:1a0:53af:58f6 with SMTP id p9-20020a170902e74900b001a053af58f6mr3743891plf.1.1679100581075; Fri, 17 Mar 2023 17:49:41 -0700 (PDT) MIME-Version: 1.0 References: <20230317203601.55027-1-jwakely@redhat.com> In-Reply-To: <20230317203601.55027-1-jwakely@redhat.com> From: Nathaniel Shead Date: Sat, 18 Mar 2023 11:49:27 +1100 Message-ID: Subject: Re: [committed] libstdc++: Add const to hash>::operator() [PR109165] To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Mar 18, 2023 at 7:36=E2=80=AFAM Jonathan Wakely via Libstdc++ wrote: > > Tested x86_64-linux. Pushed to trunk. gcc-12 backport needed too. > > -- >8 -- > > libstdc++-v3/ChangeLog: > > PR libstdc++/109165 > * include/std/coroutine (hash<>::operator()): Add const. > * testsuite/18_support/coroutines/hash.cc: New test. > --- > libstdc++-v3/include/std/coroutine | 2 +- > .../testsuite/18_support/coroutines/hash.cc | 22 +++++++++++++++++++ > 2 files changed, 23 insertions(+), 1 deletion(-) > create mode 100644 libstdc++-v3/testsuite/18_support/coroutines/hash.cc > > diff --git a/libstdc++-v3/include/std/coroutine b/libstdc++-v3/include/st= d/coroutine > index f6e65566f10..b0ca18949db 100644 > --- a/libstdc++-v3/include/std/coroutine > +++ b/libstdc++-v3/include/std/coroutine > @@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct hash> > { > size_t > - operator()(const coroutine_handle<_Promise>& __h) noexcept > + operator()(const coroutine_handle<_Promise>& __h) const noexcept > { > return reinterpret_cast(__h.address()); > } > diff --git a/libstdc++-v3/testsuite/18_support/coroutines/hash.cc b/libst= dc++-v3/testsuite/18_support/coroutines/hash.cc > new file mode 100644 > index 00000000000..68e5e640477 > --- /dev/null > +++ b/libstdc++-v3/testsuite/18_support/coroutines/hash.cc > @@ -0,0 +1,22 @@ > +// { dg-options "-std=3Dgnu++2a" } > +// { dg-do run { target c++2a } } > + > +#include > +#include > + > +void > +test01() > +{ > + std::hash h; > + std::size_t v =3D h(std::noop_coroutine()); > + > + const auto& ch =3D h; > + std::size_t v2 =3D h(std::noop_coroutine()); // PR libstdc++/109165 Is this supposed to be `std::size_t v2 =3D ch(...)`? > + > + VERIFY( v2 =3D=3D v ); > +} > + > +int main() > +{ > + test01(); > +} > -- > 2.39.2 >