From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 883F838582B1; Fri, 16 Feb 2024 15:12:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 883F838582B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708096340; bh=OIl87YNokcXHLhZRmPzBpX8E59cZ8/jiNUBTkw3TXUY=; h=From:To:Subject:Date:From; b=L/jT1uycigqIlAt6NWKq6OKT7K9RaPrc1jC1vH1/K04dNonnf+CKZDYNQACJjY0Qz VnBi97BBvDbpdwF8jp4OHNUyCIUprYhgc2iPiOt2hPbPIQmohL3ZK1EoaG4OWfNRrw LbjKgoESY9Flr1ZQ1+zlA+wYyITdCtt93O+eaw4U= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-8332] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: f516fc119770d75cb856faccba1d129a9c091b29 X-Git-Newrev: e1a1e817fcaf998d8b2f6ba0e041d4a1d42c3352 Message-Id: <20240216151220.883F838582B1@sourceware.org> Date: Fri, 16 Feb 2024 15:12:20 +0000 (GMT) List-Id: https://gcc.gnu.org/g:e1a1e817fcaf998d8b2f6ba0e041d4a1d42c3352 commit r13-8332-ge1a1e817fcaf998d8b2f6ba0e041d4a1d42c3352 Author: Jonathan Wakely Date: Thu Feb 8 15:38:35 2024 +0000 libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin These non-standard extensions use GCC-specific built-ins. Use __has_builtin to avoid errors when Clang compiles this header. See https://github.com/llvm/llvm-project/issues/24289 libstdc++-v3/ChangeLog: * include/tr2/type_traits (bases, direct_bases): Use __has_builtin to check if required built-ins are supported. (cherry picked from commit 5fb204aaf34b68c427f5b2bfb933fed72fe3eafb) Diff: --- libstdc++-v3/include/tr2/type_traits | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits index 8723ab521d71..ae7f406ff2c3 100644 --- a/libstdc++-v3/include/tr2/type_traits +++ b/libstdc++-v3/include/tr2/type_traits @@ -82,20 +82,23 @@ namespace tr2 /// Sequence abstraction metafunctions for manipulating a typelist. - +#if __has_builtin(__bases) /// Enumerate all the base classes of a class. Form of a typelist. template struct bases { typedef __reflection_typelist<__bases(_Tp)...> type; }; +#endif +#if __has_builtin(__direct_bases) /// Enumerate all the direct base classes of a class. Form of a typelist. template struct direct_bases { typedef __reflection_typelist<__direct_bases(_Tp)...> type; }; +#endif /// @} group metaprogramming }