From patchwork Fri Mar 15 07:20:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1912371 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=AaSmbZSU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Twwhf246Yz1yWn for ; Fri, 15 Mar 2024 18:23:29 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 046C4385829C for ; Fri, 15 Mar 2024 07:23:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 046C4385829C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710487407; bh=hsofhBw2wGU28mJ1qOwoNxa3mUc8HIIOZuU+tBbTqM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AaSmbZSU6KL3TV5yQH0idjYxKq5/VvaH6fOSiWN8Y1EUDBA/c5HdyLnHdWXGpRvzi GSG/D9dDcIyyH3fCDwQVgGCkEeQ7vVQJkLr0nnKNQLauX5MUmxviqoTlks6278ClTD 2fxicmXiv0virunHY0m6B6YqnLpxH14fY23WmtO8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id 3DA243858D28; Fri, 15 Mar 2024 07:22:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3DA243858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gcc.gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3DA243858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.177.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710487373; cv=none; b=c0kkN3uIuOfHSDJwTTfmM23+xttMiiMNWyAT4NmvsEjnTwHQwtBWBXSgIKNcNiFIDBIZm9bd4sF4S1/5cNBKW21fZ4gRD56l9ONTbfI52dxEQxrnp8J39rDCHdkqzhcn0OUQ4HUprJQCso3gNXPGDgvlmBSdYo0mjkFoWKtVzlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710487373; c=relaxed/simple; bh=TKmGBCUBYW8XSt5x9Hkfj5lShSOqi5DPXIxaoZqov34=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=w5zPO581rRYIKJz5VNXpP8LPC13deoufzDdN4cWcSbKo1zTd3nKVk5yKkSGJytuY0jTeRO5B6euLK8/nsK7gkh2EO1k33zBohEoDDhglI2xC+H5AhwIGAJ96bQim1UBTQi7E11Lw5dNInlnZQ3GrurULbSgEDyWxQ6jhuSPZViY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247480.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42F76dqg015068; Fri, 15 Mar 2024 07:22:48 GMT Received: from mxout25.s.uw.edu (mxout25.s.uw.edu [140.142.234.175]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3wvafjt5qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Mar 2024 07:22:48 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.132]) by mxout25.s.uw.edu (8.14.4+UW20.07/8.14.4+UW24.02) with ESMTP id 42F7MihQ019452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Mar 2024 00:22:44 -0700 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.154.74.128]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW24.02) with ESMTPSA id 42F7Mirl014779 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Mar 2024 00:22:44 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu From: Ken Matsui To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, ppalka@redhat.com, Ken Matsui Subject: [PATCH v3 2/2] extend.texi: Add documentation for all missing built-in traits [PR87343] Date: Fri, 15 Mar 2024 00:20:43 -0700 Message-ID: <20240315072042.1751225-3-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240314072234.880769-2-kmatsui@gcc.gnu.org> References: <20240314072234.880769-2-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: O_dVjvStfWdcHDpsZrWISyqMJSpFSVRr X-Proofpoint-ORIG-GUID: O_dVjvStfWdcHDpsZrWISyqMJSpFSVRr x-header: uw-relay-non-domains X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-14_13,2024-03-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 clxscore=1034 phishscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403150059 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NEUTRAL, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org PR c++/87343 gcc/ChangeLog: * doc/extend.texi (Expression-yielding Type Traits): New subsection. (Type-yielding Type Traits): Likewise. (C++ Concepts): Move __is_same to ... (Expression-yielding Type Traits): ... here. (__has_unique_object_representations) New documentation. (__is_array): Likewise. (__is_assignable): Likewise. (__is_bounded_array): Likewise. (__is_constructible): Likewise. (__is_convertible): Likewise. (__is_function): Likewise. (__is_layout_compatible): Likewise. (__is_member_function_pointer): Likewise. (__is_member_object_pointer): Likewise. (__is_member_pointer): Likewise. (__is_nothrow_assignable): Likewise. (__is_nothrow_constructible): Likewise. (__is_nothrow_convertible): Likewise. (__is_object): Likewise. (__is_pointer_interconvertible_base_of): Likewise. (__is_reference): Likewise. (__is_scoped_enum): Likewise. (__is_trivially_assignable): Likewise. (__is_trivially_constructible): Likewise. (__is_trivially_copyable): Likewise. (__reference_constructs_from_temporary): Likewise. (__reference_converts_from_temporary): Likewise. (__bases): Likewise. (__direct_bases): Likewise. (__remove_cv): Likewise. (__remove_cvref): Likewise. (__remove_pointer): Likewise. (__remove_reference): Likewise. (__type_pack_element): Likewise. (__underlying_type): Likewise. (__is_enum): Add @anchor and @ref to related traits. (__is_trivial): Likewise. Signed-off-by: Ken Matsui --- gcc/doc/extend.texi | 279 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 270 insertions(+), 9 deletions(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 1c61682b102..2c8199fb1ab 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -29489,6 +29489,12 @@ compile-time determination of various characteristics of a type (or of a pair of types). + +@subsection Expression-yielding Type Traits + +These built-in traits yield an expression of type @code{bool} +or @code{size_t}. + @defbuiltin{bool __has_nothrow_assign (@var{type})} If @var{type} is @code{const}-qualified or is a reference type then the trait is @code{false}. Otherwise if @code{__has_trivial_assign (type)} @@ -29555,6 +29561,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @enddefbuiltin +@defbuiltin{bool __has_unique_object_representations (@var{type})} +If @code{__is_trivially_copyable (type)} is @code{true} and @var{type} +has no padding bits, meaning that any two objects of @var{type} with +the same value will have identical object representations, then +the trait is @code{true}, else it is @code{false}. +Requires: @var{type} shall be a complete type, (possibly cv-qualified) +@code{void}, or an array of unknown bound. +@enddefbuiltin + @defbuiltin{bool __has_virtual_destructor (@var{type})} If @var{type} is a class type with a virtual destructor ([class.dtor]) then the trait is @code{true}, else it is @code{false}. @@ -29580,6 +29595,23 @@ If @var{type} is an aggregate type ([dcl.init.aggr]) the trait is Requires: If @var{type} is a class type, it shall be a complete type. @enddefbuiltin +@anchor{__is_array} +@defbuiltin{bool __is_array (@var{type})} +If @var{type} is an array type ([dcl.array]) the trait is @code{true}, +else it is @code{false}. +See also: @ref{__is_bounded_array}. +@enddefbuiltin + +@anchor{__is_assignable} +@defbuiltin{bool __is_assignable (@var{type1}, @var{type2})} +If @var{type1} is a class type that has an assignment operator +accepting @var{type2}, or if @var{type2} can be implicitly converted to +a type that @var{type1} can accept on assignment, then the trait is +@code{true}, else it is @code{false}. +Requires: If @var{type1} is a class type, it shall be a complete type. +See also: @ref{__is_nothrow_assignable}, @ref{__is_trivially_assignable}. +@enddefbuiltin + @defbuiltin{bool __is_base_of (@var{base_type}, @var{derived_type})} If @var{base_type} is a base class of @var{derived_type} ([class.derived]) then the trait is @code{true}, otherwise it is @code{false}. @@ -29592,11 +29624,37 @@ type (disregarding cv-qualifiers), @var{derived_type} shall be a complete type. A diagnostic is produced if this requirement is not met. @enddefbuiltin +@anchor{__is_bounded_array} +@defbuiltin{bool __is_bounded_array (@var{type})} +If @var{type} is an array type of known bound ([dcl.array]) +the trait is @code{true}, else it is @code{false}. +See also: @ref{__is_array}. +@enddefbuiltin + @defbuiltin{bool __is_class (@var{type})} If @var{type} is a cv-qualified class type, and not a union type ([basic.compound]) the trait is @code{true}, else it is @code{false}. @enddefbuiltin +@anchor{__is_constructible} +@defbuiltin{bool __is_constructible (@var{type}, @var{arg_types}...)} +If @var{type} is an object or reference type that can be constructed with +arguments of types @var{arg_types}..., then the trait is @code{true}, +else it is @code{false}. +Requires: If @var{type} or @var{arg_types}... is a class type, it shall be +a complete type. +See also: @ref{__is_nothrow_constructible}, @ref{__is_trivially_constructible}. +@enddefbuiltin + +@anchor{__is_convertible} +@defbuiltin{bool __is_convertible (@var{from_type}, @var{to_type})} +If @var{from_type} can be implicitly converted to @var{to_type} then the +trait is @code{true}, else it is @code{false}. +Requires: If @var{from_type} or @var{to_type} is a class type, it shall be +a complete type. +See also: @ref{__is_nothrow_convertible}. +@enddefbuiltin + @c FIXME Commented out for GCC 13, discuss user interface for GCC 14. @c @defbuiltin{bool __is_deducible (@var{template}, @var{type})} @c If template arguments for @code{template} can be deduced from @@ -29614,9 +29672,11 @@ has no base classes @var{base_type} for which Requires: If @var{type} is a non-union class type, it shall be a complete type. @enddefbuiltin +@anchor{__is_enum} @defbuiltin{bool __is_enum (@var{type})} If @var{type} is a cv enumeration type ([basic.compound]) the trait is @code{true}, else it is @code{false}. +See also: @ref{__is_scoped_enum}. @enddefbuiltin @defbuiltin{bool __is_final (@var{type})} @@ -29625,6 +29685,18 @@ is @code{true}, else it is @code{false}. Requires: If @var{type} is a class type, it shall be a complete type. @enddefbuiltin +@defbuiltin{bool __is_function (@var{type})} +If @var{type} is a function type ([dcl.fct]) the trait is @code{true}, +else it is @code{false}. +@enddefbuiltin + +@defbuiltin{bool __is_layout_compatible (@var{type1}, @var{type2})} +If @var{type1} and @var{type2} are layout-compatible ([basic.types]) then +the trait is @code{true}, else it is @code{false}. +Requires: @var{type1} and @var{type2} shall be complete types, (possibly +cv-qualified) @code{void}, or arrays of unknown bound. +@enddefbuiltin + @defbuiltin{bool __is_literal_type (@var{type})} If @var{type} is a literal type ([basic.types]) the trait is @code{true}, else it is @code{false}. @@ -29632,6 +29704,72 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @enddefbuiltin +@anchor{__is_member_function_pointer} +@defbuiltin{bool __is_member_function_pointer (@var{type})} +If @var{type} is a pointer to member function type ([dcl.mptr]) the trait is +@code{true}, else it is @code{false}. +See also: @ref{__is_member_object_pointer}, @ref{__is_member_pointer}. +@enddefbuiltin + +@anchor{__is_member_object_pointer} +@defbuiltin{bool __is_member_object_pointer (@var{type})} +If @var{type} is a pointer to member object type ([dcl.mptr]) the trait is +@code{true}, else it is @code{false}. +See also: @ref{__is_member_function_pointer}, @ref{__is_member_pointer}. +@enddefbuiltin + +@anchor{__is_member_pointer} +@defbuiltin{bool __is_member_pointer (@var{type})} +If @var{type} is a pointer to member type ([dcl.mptr]) the trait is +@code{true}, else it is @code{false}. +See also: @ref{__is_member_function_pointer}, @ref{__is_member_object_pointer}. +@enddefbuiltin + +@anchor{__is_nothrow_assignable} +@defbuiltin{bool __is_nothrow_assignable (@var{type1}, @var{type2})} +If @code{__is_assignable (type1, type2)} is @code{true} and the assignment +operation does not throw an exception then the trait is @code{true}, else +it is @code{false}. +Requires: If @var{type1} or @var{type2} is a class type, it shall be a +complete type. +See also: @ref{__is_assignable}, @ref{__is_trivially_assignable}. +@enddefbuiltin + +@anchor{__is_nothrow_constructible} +@defbuiltin{bool __is_nothrow_constructible (@var{type}, @var{arg_types}...)} +If @code{__is_constructible (type, arg_types...)} is @code{true} and the +construction does not throw an exception then the trait is @code{true}, +else it is @code{false}. +Requires: If @var{type} or @var{arg_types}... is a class type, it shall be +a complete type. +See also: @ref{__is_constructible}, @ref{__is_trivially_constructible}. +@enddefbuiltin + +@anchor{__is_nothrow_convertible} +@defbuiltin{bool __is_nothrow_convertible (@var{from_type}, @var{to_type})} +If @code{__is_convertible (from_type, to_type)} is @code{true} and the +conversion does not throw an exception then the trait is @code{true}, +else it is @code{false}. +Requires: If @var{from_type} or @var{to_type} is a class type, it shall be +a complete type. +See also: @ref{__is_convertible}. +@enddefbuiltin + +@defbuiltin{bool __is_object (@var{type})} +If @var{type} is an object type ([basic.types]) the trait is +@code{true}, else it is @code{false}. +@enddefbuiltin + +@defbuiltin{bool __is_pointer_interconvertible_base_of (@var{base_type}, @var{derived_type})} +If @var{base_type} and @var{derived_type} are pointer-interconvertible +([conv.ptr]) and @var{base_type} is a base class of @var{derived_type} +([class.derived]) then the trait is @code{true}, else it is @code{false}. +Requires: if @code{__is_class (base_type)} and @code{__is_class (derived_type)} +are @code{true} and @var{base_type} and @var{derived_type} are not the same +type (disregarding cv-qualifiers), @var{derived_type} shall be a complete +type. A diagnostic is produced if this requirement is not met. +@enddefbuiltin + @defbuiltin{bool __is_pod (@var{type})} If @var{type} is a cv POD type ([basic.types]) then the trait is @code{true}, else it is @code{false}. @@ -29645,6 +29783,23 @@ is @code{true}, else it is @code{false}. Requires: If @var{type} is a non-union class type, it shall be a complete type. @enddefbuiltin +@defbuiltin{bool __is_reference (@var{type})} +If @var{type} is a reference type ([dcl.ref]) the trait is @code{true}, +else it is @code{false}. +@enddefbuiltin + +@defbuiltin{bool __is_same (@var{type1}, @var{type2})} +A binary type trait: @code{true} whenever the @var{type1} and +@var{type2} refer to the same type. +@enddefbuiltin + +@anchor{__is_scoped_enum} +@defbuiltin{bool __is_scoped_enum (@var{type})} +If @var{type} is a scoped enumeration type ([dcl.enum]) the trait is +@code{true}, else it is @code{false}. +See also: @ref{__is_enum}. +@enddefbuiltin + @defbuiltin{bool __is_standard_layout (@var{type})} If @var{type} is a standard-layout type ([basic.types]) the trait is @code{true}, else it is @code{false}. @@ -29652,11 +29807,45 @@ Requires: @var{type} shall be a complete type, an array of complete types, or (possibly cv-qualified) @code{void}. @enddefbuiltin +@anchor{__is_trivial} @defbuiltin{bool __is_trivial (@var{type})} If @var{type} is a trivial type ([basic.types]) the trait is @code{true}, else it is @code{false}. Requires: @var{type} shall be a complete type, an array of complete types, or (possibly cv-qualified) @code{void}. +See also: @ref{__is_trivially_assignable}, @ref{__is_trivially_constructible}, +@ref{__is_trivially_copyable}. +@enddefbuiltin + +@anchor{__is_trivially_assignable} +@defbuiltin{bool __is_trivially_assignable (@var{type1}, @var{type2})} +If @code{__is_assignable (type1, type2)} is @code{true} and +@code{__is_trivial (type1)} is @code{true} then the trait is @code{true}, +else it is @code{false}. +Requires: If @var{type1} or @var{type2} is a class type, it shall be a +complete type. +See also: @ref{__is_trivial}, @ref{__is_assignable}, +@ref{__is_nothrow_assignable}. +@enddefbuiltin + +@anchor{__is_trivially_constructible} +@defbuiltin{bool __is_trivially_constructible (@var{type}, @var{arg_types}...)} +If @code{__is_constructible (type, arg_types...)} is @code{true} and +@code{__is_trivial (type)} is @code{true} then the trait is @code{true}, +else it is @code{false}. +Requires: If @var{type} or @var{arg_types}... is a class type, it shall be +a complete type. +See also: @ref{__is_trivial}, @ref{__is_constructible}, +@ref{__is_nothrow_constructible}. +@enddefbuiltin + +@anchor{__is_trivially_copyable} +@defbuiltin{bool __is_trivially_copyable (@var{type})} +If @var{type} is a trivially copyable type ([basic.types]) the trait is +@code{true}, else it is @code{false}. +Requires: @var{type} shall be a complete type, an array of complete types, +or (possibly cv-qualified) @code{void}. +See also: @ref{__is_trivial}. @enddefbuiltin @defbuiltin{bool __is_union (@var{type})} @@ -29664,12 +29853,93 @@ If @var{type} is a cv union type ([basic.compound]) the trait is @code{true}, else it is @code{false}. @enddefbuiltin +@anchor{__reference_constructs_from_temporary} +@defbuiltin{bool __reference_constructs_from_temporary (@var{type1}, @var{type2})} +If @var{type1} is a reference type and a value of type @var{type2} can be +bound to @var{type1} in direct-initialization, such that a temporary object +would be bound to the reference, then the trait is @code{true}, +else it is @code{false}. +Requires: If @var{type1} or @var{type2} is a class type, it shall be +a complete type. +See also: @ref{__reference_converts_from_temporary} +@enddefbuiltin + +@anchor{__reference_converts_from_temporary} +@defbuiltin{bool __reference_converts_from_temporary (@var{type1}, @var{type2})} +If @var{type1} is a reference type and a value of type @var{type2} can be +bound to @var{type1} in copy-initialization, such that a temporary object +would be bound to the reference, then the trait is @code{true}, +else it is @code{false}. +Requires: If @var{type1} or @var{type2} is a class type, it shall be +a complete type. +See also: @ref{__reference_constructs_from_temporary} +@enddefbuiltin + @defbuiltin{bool __underlying_type (@var{type})} The underlying type of @var{type}. Requires: @var{type} shall be an enumeration type ([dcl.enum]). @enddefbuiltin +@subsection Type-yielding Type Traits + +These built-in traits yield a type. + +@anchor{__bases} +@defbuiltin{@var{types}... __bases (@var{type})} +If @var{type} is a class type ([class.derived]) then the trait is a +typelist of the base classes of @var{type}, else it is an empty typelist. +See also: @ref{__direct_bases}. +@enddefbuiltin + +@anchor{__direct_bases} +@defbuiltin{@var{types}... __direct_bases (@var{type})} +If @var{type} is a class type ([class.derived]) then the trait is a +typelist of the direct base classes of @var{type}, else it is an empty +typelist. +See also: @ref{__bases}. +@enddefbuiltin + +@anchor{__remove_cv} +@defbuiltin{@var{type} __remove_cv (@var{cv_type})} +If @var{cv_type} is a cv-qualified type ([basic.type.qualifier]), then the +trait is the type @var{type} of @var{cv_type} with its top-level cv-qualifiers +removed, else it is @var{cv_type}. +See also: @ref{__remove_cvref} +@enddefbuiltin + +@anchor{__remove_cvref} +@defbuiltin{@var{type} __remove_cvref (@var{cvref_type})} +If @var{cvref_type} is a cv-qualified ([basic.type.qualifier]) or reference +type ([dcl.ref]), then the trait is the type @var{type} of +@var{cvref_type} with its top-level cv-qualifiers and reference removed, +else it is @var{cvref_type}. +See also: @ref{__remove_cv}, @ref{__remove_reference}. +@enddefbuiltin + +@defbuiltin{@var{type} __remove_pointer (@var{ptr_type})} +If @var{ptr_type} is a pointer type ([dcl.ptr]), then the trait is the +@var{type} pointed to by @var{ptr_type}, else it is @var{ptr_type}. +@enddefbuiltin + +@anchor{__remove_reference} +@defbuiltin{@var{type} __remove_reference (@var{ref_type})} +If @var{ref_type} is a reference type ([dcl.ref]), then the trait is the +@var{type} referred to by @var{ref_type}, else it is @var{ref_type}. +See also: @ref{__remove_cvref} +@enddefbuiltin + +@defbuiltin{@var{type} __type_pack_element (int @var{index}, @var{types}...)} +If 0 < @var{index} < sizeof...(@var{types}), then the trait is the +@var{index}-th type in the pack @var{types}..., else it emits an error. +@enddefbuiltin + +@defbuiltin{@var{type} __underlying_type (@var{enum_type})} +If @var{enum_type} is a complete enumeration type ([dcl.enum]), then +the trait is the underlying type of @var{enum_type}, else it emits an error. +@enddefbuiltin + + @node C++ Concepts @section C++ Concepts @@ -29708,15 +29978,6 @@ Introduces constraints on template arguments or requirements for a member function of a class template. @end table -The front end also exposes a number of internal mechanism that can be used -to simplify the writing of type traits. Note that some of these traits are -likely to be removed in the future. - -@defbuiltin{bool __is_same (@var{type1}, @var{type2})} -A binary type trait: @code{true} whenever the @var{type1} and -@var{type2} refer to the same type. -@enddefbuiltin - @node Deprecated Features @section Deprecated Features