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 363E23857728 for ; Wed, 12 Jul 2023 10:08:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 363E23857728 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689156511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nEJmsqyDwDo8i1lX6X7SBTF012PXhRfqlm7dtIXss2o=; b=h8Rq4J5SvIPEVoXhab8WckZHlyDFywf/TfezvnhR8RMnyRP1ZtqIhjFKz2lFbUJP5Xzx9s jX2ypycX0fQiovDPF1SNjjRxKC3srLxsoFQGpyeHJZHGUWuNJHJbKivSyzwd9i4FiknM0U VC1O2UIcbBG3x39qcLqGsGTHBEUufnA= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-7E7xskCSPoyOt6Jz4g2Dwg-1; Wed, 12 Jul 2023 06:08:25 -0400 X-MC-Unique: 7E7xskCSPoyOt6Jz4g2Dwg-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2b70bfcea94so51493031fa.1 for ; Wed, 12 Jul 2023 03:08:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689156503; x=1691748503; h=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=nEJmsqyDwDo8i1lX6X7SBTF012PXhRfqlm7dtIXss2o=; b=QxVq+sJZn3MhZeLocKfKnE/1tm3j823q8ePdiv3d20AS9fs+aSzsywTWHcIz4wkMGw SLgsoh0B5FHSIhuqiWZIWpC+qR1XrmzJGyDcGCdLUIzMpn/0JAcy+vXgjJ8hjxwkxCd3 DaogoSrJH17Y+wt1fZfZ5cz+vmi4TVnOWtpf3ny3Y1qsMs+BQh5P0L/u3nJ/Yn+vGPLj FXtrvQJ1MCxWgK2LFKZOLzO6tgRBKhXgOUEb9D9fMZfdbC5R0S5PdGeLykhqB4v2Sb1l r9pfA2UQhX7wnhxEy29/VHVk8r5Ck6orHrK3Ws5j3aRYX/IwVrIzpzr7NHDJVM9WkZPM TlKA== X-Gm-Message-State: ABy/qLYTgF8FhLm9dFtPGoL8IcWx7ybRqEJPKEedVjXU+n3Pbit8cB6G IYDK/GDvGIxCKPCUtPX5v+AN+YQSJGW3EB/sbjlXmj5GBSJnUqByPjSJaN4Dtvwuue3sSSyawaD MVnKwD6dme4QBVZdrxSJAWCnOubzcNJSBtw== X-Received: by 2002:a2e:908f:0:b0:2b6:9ed5:bf15 with SMTP id l15-20020a2e908f000000b002b69ed5bf15mr12223535ljg.23.1689156503746; Wed, 12 Jul 2023 03:08:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+gccsjlzEzKEp2e0gclxCuW6EUAAGLYGvZ+4edXv7KkDJoIEyubxziTxyGnkSzjWjj/qXINPwkIPrSaLzTRw= X-Received: by 2002:a2e:908f:0:b0:2b6:9ed5:bf15 with SMTP id l15-20020a2e908f000000b002b69ed5bf15mr12223516ljg.23.1689156503424; Wed, 12 Jul 2023 03:08:23 -0700 (PDT) MIME-Version: 1.0 References: <20230708051137.63707-1-kmatsui@gcc.gnu.org> <20230708051137.63707-3-kmatsui@gcc.gnu.org> In-Reply-To: <20230708051137.63707-3-kmatsui@gcc.gnu.org> From: Jonathan Wakely Date: Wed, 12 Jul 2023 11:08:12 +0100 Message-ID: Subject: Re: [PATCH v8 2/6] libstdc++: use new built-in trait __is_reference for std::is_reference To: Ken Matsui Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, 8 Jul 2023 at 06:13, Ken Matsui via Libstdc++ wrote: > > This patch gets std::is_reference to dispatch to new built-in trait > __is_reference. > > libstdc++-v3/ChangeLog: > > * include/std/type_traits (is_reference): Use __is_reference built-in > trait. > (is_reference_v): Likewise. > > Signed-off-by: Ken Matsui OK for trunk after the front-end __is_reference is committed. > --- > libstdc++-v3/include/std/type_traits | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index 0e7a9c9c7f3..2a14df7e5f9 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -639,6 +639,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > // Composite type categories. > > /// is_reference > +#if __has_builtin(__is_reference) > + template > + struct is_reference > + : public __bool_constant<__is_reference(_Tp)> > + { }; > +#else > template > struct is_reference > : public false_type > @@ -653,6 +659,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct is_reference<_Tp&&> > : public true_type > { }; > +#endif > > /// is_arithmetic > template > @@ -3192,12 +3199,19 @@ template > inline constexpr bool is_class_v = __is_class(_Tp); > template > inline constexpr bool is_function_v = is_function<_Tp>::value; > + > +#if __has_builtin(__is_reference) > +template > + inline constexpr bool is_reference_v = __is_reference(_Tp); > +#else > template > inline constexpr bool is_reference_v = false; > template > inline constexpr bool is_reference_v<_Tp&> = true; > template > inline constexpr bool is_reference_v<_Tp&&> = true; > +#endif > + > template > inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; > template > -- > 2.41.0 >