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 B5B733858D1E for ; Fri, 2 Sep 2022 16:38:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B5B733858D1E 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=1662136707; 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: content-transfer-encoding:content-transfer-encoding; bh=OMwtGwpCiUYh2aduSnifiTJ44IsN2H/2wffMehfvMNY=; b=eDy5VgCSX8bvKpti5qAfQi813Epp1d2oCM4fvn86qYkl1gSlnLkUfc5F5u5K9tIWvNSstM AggdGrflF0Dp+CRJluXgZ+l5h1WO0WfNtSieaZENG6fgpYu8rdxAUaLTxxvnadbpc3XCUt 23QDb9RP0vj3e8c35bxPGp70cPWXlxQ= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-630-8gUiEagSNCumfe0uCjnpJQ-1; Fri, 02 Sep 2022 12:38:26 -0400 X-MC-Unique: 8gUiEagSNCumfe0uCjnpJQ-1 Received: by mail-qk1-f198.google.com with SMTP id ay10-20020a05620a178a00b006bbcab9d554so2345241qkb.13 for ; Fri, 02 Sep 2022 09:38:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=OMwtGwpCiUYh2aduSnifiTJ44IsN2H/2wffMehfvMNY=; b=65G7+irpfgA7EbK7wpMkI2pwJ5Wl7UGJU5W6RehrttTFNq7vjp0FUapNhJlq+/EKK6 g+3dos0J1nY//DB4eho/N+vmNeNvs5NTbODY/8xCxtb+Wd+zSI+LWz77slLHofNkmo8j Z+5u+bi3ybGO85AU/m7PBsZOGL2i3QtooL8HG7zMThE4YaQFhjnGdZyxeO4Fdap0SwHz 6ZpB0BdenOqfL5yEewlbmLOLSz7zCtgPhGktiuDvnPqrone6+1d88HyzOCH9IAGdt8R8 vFFalyI+PboEa2pENzZMIUhEFZ4bC7oSe5odwOH63cNSfJwWRx90kcEvCiTlH1GPB3Ai c7LQ== X-Gm-Message-State: ACgBeo3YqT69QtcDid9W8DQuERL77e1o7Kr+2ZVyLBo1p7TCiKajw7KJ 1kEAkFvmXk73Ws2AEBWniJk9BNY6IiwcPPndi7uEE2PCyO2qzGRLk9+5slFZgNjNfxSwusml0oX gM5vM41Z8q4wrla0= X-Received: by 2002:a37:347:0:b0:6bb:e4e5:de57 with SMTP id 68-20020a370347000000b006bbe4e5de57mr23511869qkd.123.1662136705993; Fri, 02 Sep 2022 09:38:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xfP/i155to34sI3I43kl22oOhfoI3vi9jjMTKD0RN14+fOLWUeFh+FwOnmNMgPFaBPpuZpQ== X-Received: by 2002:a37:347:0:b0:6bb:e4e5:de57 with SMTP id 68-20020a370347000000b006bbe4e5de57mr23511857qkd.123.1662136705741; Fri, 02 Sep 2022 09:38:25 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id a15-20020a05622a064f00b003437a694049sm1327584qtb.96.2022.09.02.09.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 09:38:24 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: Consistently use ::type when deriving from __and/or/not_ Date: Fri, 2 Sep 2022 12:38:16 -0400 Message-Id: <20220902163816.748210-1-ppalka@redhat.com> X-Mailer: git-send-email 2.37.2.490.g6c8e4ee870 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-14.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,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: Now that these internal type traits are again class templates, it's better to derive from the trait's ::type (which is either false_type or true_type) instead of from the trait itself, for sake of a shallower inheritance chain. We usually do this but not always; this patch makes us consistently do so. Tested on x86_64-pc-lnux-gnu, does this look OK for trunk? (Compile time for join.cc decreases by about 0.5% with this, avg of 10 runs.) libstdc++-v3/ChangeLog: * include/std/tuple (tuple::_UseOtherCtor): Do ::type when deriving from __and_, __or_ or __not_. * include/std/type_traits (negation): Likewise. (is_unsigned): Likewise. (__is_implicitly_default_constructible): Likewise. (is_trivially_destructible): Likewise. (__is_nt_invocable_impl): Likewise. --- libstdc++-v3/include/std/tuple | 2 +- libstdc++-v3/include/std/type_traits | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index ddd7c226d80..26e248431ec 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -826,7 +826,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // then TUPLE should match tuple(UTypes&&...) instead. template struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>> - : __or_, is_constructible<_Tp, _Tuple>> + : __or_, is_constructible<_Tp, _Tuple>>::type { }; // If TUPLE and *this each have a single element of the same type, // then TUPLE should match a copy/move constructor instead. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index be9f2955539..c0bb1cf64e3 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -235,7 +235,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct negation - : __not_<_Pp> + : __not_<_Pp>::type { }; /** @ingroup variable_templates @@ -845,7 +845,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_unsigned template struct is_unsigned - : public __and_, __not_>> + : public __and_, __not_>>::type { }; /// @cond undocumented @@ -1222,7 +1222,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_implicitly_default_constructible : public __and_<__is_constructible_impl<_Tp>, - __is_implicitly_default_constructible_safe<_Tp>> + __is_implicitly_default_constructible_safe<_Tp>>::type { }; /// is_trivially_copy_constructible @@ -1282,7 +1282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct is_trivially_destructible : public __and_<__is_destructible_safe<_Tp>, - __bool_constant<__has_trivial_destructor(_Tp)>> + __bool_constant<__has_trivial_destructor(_Tp)>>::type { static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), "template argument must be a complete class or an unbounded array"); @@ -2975,7 +2975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __is_nt_invocable_impl<_Result, _Ret, __void_t> : __or_, - __is_nothrow_convertible> + __is_nothrow_convertible>::type { }; /// @endcond -- 2.37.2.490.g6c8e4ee870