From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 915373858C2F; Mon, 20 Mar 2023 09:12:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 915373858C2F 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-ed1-x52b.google.com with SMTP id r11so43836288edd.5; Mon, 20 Mar 2023 02:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679303527; 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=7GDvfdHQVi0cBr4Nv9qFwRVCcEx1qiNymKzVQnhk1fA=; b=UGKDL5SzaRV4/C94rNh07TjjMyXv/42oiHBQ+rQ8MTp42oK+6x8aaBDbaApNzdvlJ+ RXzWDNi3wHmQlgvZrgdM+Q5Q2kj8ZXmDZnNWOjyDA4hGi8A67VdsbLCurQqCkBTWxmgu mJEN4jUp24jp38NFsXn7JqujCYXWF+6/SEyam9WoOjovpZ5JAs6PA9Jox+fi9nJ9oe6t 9nXFngbjp0RpHkzgHPa8esfZHIbln4ifcPlzl6utl5KI12y5g24Oc2GM7UCbm547pfJI AdudQEMK9W2LoaQ66kwX3M6mYkq7nIi0l1xLRlcxoLLOk0JcJmgCZuEQmGr/KIJse8G6 MqAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679303527; 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=7GDvfdHQVi0cBr4Nv9qFwRVCcEx1qiNymKzVQnhk1fA=; b=CJIV2iZ264XafP5Yfz/2DKPVxCoXo0zEevIEEiWP8dY1zLx67t7XyLh/4oOG6En+d1 vvFL3pfO55RUctBXeepkizZAVCKv487P1XCLUmN5Pbyrj+EW2aEAO7LomD/KrcehSCN8 3hQ48Jn5Z4jn/P808qTCriVNgHPMIx+exd3Qk3X1GlQ7VBAjkdUBOpPy0aYmRe+HOIC/ SPW0dBzUObf0CY8jqdX0nPDh3Csna0HT2X3MZ7QIIqcWQx711xK+FvWBOrtCHWXZ3M2e F2jO7L51kExBq0zNxk+yLm4zCQtgM0I9vl7GOJExbrRpwS25oA758NvcxZRqcVHSBeq3 Cd7A== X-Gm-Message-State: AO0yUKXUplHn5AvYXxt8yxNZFMKt5TMaCAaDFUEeKlGPkN7f7wl4nHQI 45WNhW/gomWvJBELfRImp/jE/2/PQTejS2nR3kQ= X-Google-Smtp-Source: AK7set8+GvX02bjOQo/1szGnmS+03AXz8BEmqdfAjnrO+LDOB3K6J260I28s509nLtNUIQgPFoWd//1RDwspaYnD8bs= X-Received: by 2002:a17:906:c347:b0:930:310:abc3 with SMTP id ci7-20020a170906c34700b009300310abc3mr3266771ejb.13.1679303526854; Mon, 20 Mar 2023 02:12:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 20 Mar 2023 09:11:55 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: use new built-in trait __remove_pointer To: Ken Matsui Cc: gcc-patches , Patrick Palka , "libstdc++" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.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 Mon, 20 Mar 2023 at 08:08, Ken Matsui wrote: > > Ooh... Thank you for pointing that out! > > > The helper doesn't need to be defined for the case where we don't use i= t. > > I thought that macroing them out leads to compiler errors since users > are possibly using those helpers. But do we not have to care about > that? No, absolutely not. > > --- > libstdc++-v3/ChangeLog: > > * include/std/type_traits (remove_pointer): Use __remove_pointer built-in= trait. > > --- > diff --git a/libstdc++-v3/include/std/type_traits > b/libstdc++-v3/include/std/type_traits > index 2bd607a8b8f..cba98091aad 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -2025,17 +2025,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > template > struct __remove_pointer_helper > - { typedef _Tp type; }; > + { using type =3D _Tp; }; > > template > struct __remove_pointer_helper<_Tp, _Up*> > - { typedef _Up type; }; > + { using type =3D _Up; }; > > /// remove_pointer > +#if __has_builtin(__remove_pointer) > + template > + struct remove_pointer > + { using type =3D __remove_pointer(_Tp); }; > +#else > template > struct remove_pointer > : public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>> > { }; > +#endif > > template > struct __add_pointer_helper > > On Mon, Mar 20, 2023 at 12:57=E2=80=AFAM Jonathan Wakely wrote: > > > > > > > > On Mon, 20 Mar 2023, 07:32 Ken Matsui via Libstdc++, wrote: > >> > >> CCing libstdc++@gcc.gnu.org. > >> > >> On Sun, Mar 19, 2023 at 7:53=E2=80=AFPM Ken Matsui wrote: > >> > > >> > libstdc++-v3/ChangeLog: > >> > > >> > * include/std/type_traits (is_reference): Use __remove_pointer built= -in trait. > > > > > > The changelog entry says is_reference but the patch is for remove_point= er. > > > > > >> > > >> > --- > >> > diff --git a/libstdc++-v3/include/std/type_traits > >> > b/libstdc++-v3/include/std/type_traits > >> > index 2bd607a8b8f..cba98091aad 100644 > >> > --- a/libstdc++-v3/include/std/type_traits > >> > +++ b/libstdc++-v3/include/std/type_traits > >> > @@ -2025,17 +2025,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > >> > > >> > template > >> > struct __remove_pointer_helper > >> > - { typedef _Tp type; }; > >> > + { using type =3D _Tp; }; > >> > > >> > template > >> > struct __remove_pointer_helper<_Tp, _Up*> > >> > - { typedef _Up type; }; > >> > + { using type =3D _Up; }; > > > > > > The helper doesn't need to be defined for the case where we don't use i= t. > > > > > >> > > >> > /// remove_pointer > >> > +#if __has_builtin(__remove_pointer) > >> > + template > >> > + struct remove_pointer > >> > + { using type =3D __remove_pointer(_Tp); }; > >> > +#else > >> > template > >> > struct remove_pointer > >> > : public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>> > >> > { }; > >> > +#endif > >> > > >> > template > >> > struct __add_pointer_helper