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.129.124]) by sourceware.org (Postfix) with ESMTPS id 6C7073858D20 for ; Wed, 12 Jul 2023 09:50:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C7073858D20 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=1689155447; 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=mD4v1QdCy2eXWaXz2/DcZAsQz33Y5zzoNW8OR3DE4rI=; b=O8OfELMrXkQQ/gRYUxQsR7VB2scyu7kEU7Y0Mdbyntxob5aTdj080JME56X+ZoTViI/t8d z5TQw72fRH+eRRHtW43MabJczBGVIRtn1CxC3XDg2mlzKX2AhVbJTgYhZ2c376GasVewAC xFg/mx8Lovq40JefJop9w3zcmhOJMy8= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-ukXRtBbIOwKOvhACp72SXg-1; Wed, 12 Jul 2023 05:50:43 -0400 X-MC-Unique: ukXRtBbIOwKOvhACp72SXg-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2b69e64ddabso64651921fa.0 for ; Wed, 12 Jul 2023 02:50:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689155441; x=1691747441; 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=mD4v1QdCy2eXWaXz2/DcZAsQz33Y5zzoNW8OR3DE4rI=; b=BzKDS6pRw/X2BqwjHC9Lc0E9LK/FYcuE4JCKwpcxxZimh2YdhwETEyLVrj3hIaN4pU HWYYd9AnBEg3m6mGWiXq5Kftca/YOADPfh2WN1NSHv8iCyqzJbLsk3o1H64cI9TS96BJ WN7mYnmXXpp7NoRC6GRTfpdJ6T0GupNXJ1mp/f0tGDJug7PdGxM8VJoEknMNcan3ko5j DgF4/RRN+2/eZAe92WnTMSKin4lbNta8GtN03yTVKzGX1ZM+KhvFkuTyFSeGBhCJS1qN TGHXEAvhG3ekjQqFavtBzkIhWeBknjTLT76ADtV92/bqaBtkSawx7qcggIwqQDlmLhYh zxMw== X-Gm-Message-State: ABy/qLamTosu8MnK2SJYKAi1hsXq6h2LelOO7CQIGl9jQz4Q6BZuUxrt lu/mCih/Iggh/Q1VCXWdCJvuE+Mlpf8xpaUOzWa6Ch1cUtlGrBv5xDlJZcZRf6uc/ZKc14aDYOO vkkV3/Ef2GvfDqOHmujIfep5PW8Q7iNOzY6CJQQX4zg== X-Received: by 2002:a2e:b60d:0:b0:2b6:fc60:776f with SMTP id r13-20020a2eb60d000000b002b6fc60776fmr14399017ljn.30.1689155441637; Wed, 12 Jul 2023 02:50:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlEhrSrLgWObbADHXQU1Y3RlbmNDyuFxi2oi0oxXO2m61HMGJakC/wLcbsS4VgllJFO3BWGVPvERKNmY3s4/fgw= X-Received: by 2002:a2e:b60d:0:b0:2b6:fc60:776f with SMTP id r13-20020a2eb60d000000b002b6fc60776fmr14398995ljn.30.1689155441004; Wed, 12 Jul 2023 02:50:41 -0700 (PDT) MIME-Version: 1.0 References: <20230708044539.61276-1-kmatsui@gcc.gnu.org> <20230708044539.61276-2-kmatsui@gcc.gnu.org> In-Reply-To: <20230708044539.61276-2-kmatsui@gcc.gnu.org> From: Jonathan Wakely Date: Wed, 12 Jul 2023 10:50:29 +0100 Message-ID: Subject: Re: [PATCH v2 2/2] libstdc++: use new built-in trait __is_scalar for std::is_scalar 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.0 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 05:47, Ken Matsui via Libstdc++ wrote: > > This patch gets std::is_scalar to dispatch to new built-in trait > __is_scalar. > > libstdc++-v3/ChangeLog: > > * include/std/type_traits (is_scalar): Use __is_scalar built-in > trait. > (is_scalar_v): Likewise. OK for trunk (conditional on the front-end change being committed first of course). > > Signed-off-by: Ken Matsui > --- > 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..bc90b2c61ca 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -678,11 +678,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct is_member_pointer; > > /// is_scalar > +#if __has_builtin(__is_scalar) > + template > + struct is_scalar > + : public __bool_constant<__is_scalar(_Tp)> > + { }; > +#else > template > struct is_scalar > : public __or_, is_enum<_Tp>, is_pointer<_Tp>, > is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type > { }; > +#endif > > /// is_compound > template > @@ -3204,8 +3211,15 @@ template > inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; > template > inline constexpr bool is_object_v = is_object<_Tp>::value; > + > +#if __has_builtin(__is_scalar) > +template > + inline constexpr bool is_scalar_v = __is_scalar(_Tp); > +#else > template > inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; > +#endif > + > template > inline constexpr bool is_compound_v = is_compound<_Tp>::value; > template > -- > 2.41.0 >