From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7934) id 05F6D3858035; Sat, 8 Jul 2023 05:07:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05F6D3858035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688792866; bh=wpqvrD4BdoHthr3t3o7oiK4LaKWsjo1LIPscp+yeEaE=; h=From:To:Subject:Date:From; b=LDMyllxazyWumG0kTxQEEgGaeUDHYINKfpPFH44zs8trsy0PiTLANBJ+QAhkwLhjX EruoCrzoataEaCGXXzHgeY+ttEdK7O4NXVuI9BIFjk6L9qcseonOCArSW+/4cOo/x7 D+52SOGzoGrWFCZgn678wcBtjF/EuvOz8v9C/kiQ= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ken Matsui To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/kmatsui/heads/is_object)] libstdc++: make std::is_object dispatch to new built-in traits X-Act-Checkin: gcc X-Git-Author: Ken Matsui X-Git-Refname: refs/users/kmatsui/heads/is_object X-Git-Oldrev: da23aa96c235755fd815b00cec0e959446ab2804 X-Git-Newrev: 6cba4940fc5765c91ff67e7c74df7384a5e0b4e7 Message-Id: <20230708050746.05F6D3858035@sourceware.org> Date: Sat, 8 Jul 2023 05:07:46 +0000 (GMT) List-Id: https://gcc.gnu.org/g:6cba4940fc5765c91ff67e7c74df7384a5e0b4e7 commit 6cba4940fc5765c91ff67e7c74df7384a5e0b4e7 Author: Ken Matsui Date: Thu Mar 30 02:13:49 2023 -0700 libstdc++: make std::is_object dispatch to new built-in traits This patch gets std::is_object to dispatch to new built-in traits, __is_function, __is_reference, and __is_void. libstdc++-v3/ChangeLog: * include/std/type_traits (is_object): Use new built-in traits, __is_function, __is_reference, and __is_void. (is_object_v): Likewise. Signed-off-by: Ken Matsui Diff: --- libstdc++-v3/include/std/type_traits | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 780fcc00135..715310f10bf 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -682,11 +682,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /// is_object +#if __has_builtin(__is_function) && __has_builtin(__is_reference) \ + && __has_builtin(__is_void) + template + struct is_object + : public __bool_constant + { }; +#else template struct is_object : public __not_<__or_, is_reference<_Tp>, is_void<_Tp>>>::type { }; +#endif template struct is_member_pointer; @@ -3235,8 +3244,17 @@ template inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; template inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; + +#if __has_builtin(__is_function) && __has_builtin(__is_reference) \ + && __has_builtin(__is_void) +template + inline constexpr bool is_object_v + = !(__is_function(_Tp) || __is_reference(_Tp) || __is_void(_Tp)); +#else template inline constexpr bool is_object_v = is_object<_Tp>::value; +#endif + template inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; template