* [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically
@ 2024-03-02 0:22 Ken Matsui
2024-03-02 0:22 ` [PATCH 02/11] gcc/doc/extend.texi: Add documentation for __is_array Ken Matsui
` (23 more replies)
0 siblings, 24 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
This patch sorts built-in traits alphabetically for better codebase
consistency and easier future integration of changes.
gcc/ChangeLog:
* doc/extend.texi (Type Traits): Sort built-in traits
alphabetically.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 62 ++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index f679c81acf2..b13f9d6f934 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29499,15 +29499,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
-@defbuiltin{bool __has_nothrow_copy (@var{type})}
-If @code{__has_trivial_copy (type)} is @code{true} then the trait is
-@code{true}, else if @var{type} is a cv-qualified class or union type
-with copy constructors that are known not to throw an exception 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_nothrow_constructor (@var{type})}
If @code{__has_trivial_constructor (type)} is @code{true} then the trait
is @code{true}, else if @var{type} is a cv class or union type (or array
@@ -29517,6 +29508,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@defbuiltin{bool __has_nothrow_copy (@var{type})}
+If @code{__has_trivial_copy (type)} is @code{true} then the trait is
+@code{true}, else if @var{type} is a cv-qualified class or union type
+with copy constructors that are known not to throw an exception 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_trivial_assign (@var{type})}
If @var{type} is @code{const}- qualified or is a reference type then
the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
@@ -29527,15 +29527,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
-@defbuiltin{bool __has_trivial_copy (@var{type})}
-If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
-type then the trait is @code{true}, else if @var{type} is a cv class
-or union type with a trivial copy constructor ([class.copy]) 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_trivial_constructor (@var{type})}
If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
else if @var{type} is a cv-qualified class or union type (or array thereof)
@@ -29545,6 +29536,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@defbuiltin{bool __has_trivial_copy (@var{type})}
+If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
+type then the trait is @code{true}, else if @var{type} is a cv class
+or union type with a trivial copy constructor ([class.copy]) 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_trivial_destructor (@var{type})}
If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
then the trait is @code{true}, else if @var{type} is a cv class or union
@@ -29560,6 +29560,13 @@ If @var{type} is a class type with a virtual destructor
Requires: If @var{type} is a non-union class type, it shall be a complete type.
@enddefbuiltin
+@defbuiltin{bool __integer_pack (@var{length})}
+When used as the pattern of a pack expansion within a template
+definition, expands to a template argument pack containing integers
+from @code{0} to @code{@var{length}-1}. This is provided for
+efficient implementation of @code{std::make_integer_sequence}.
+@enddefbuiltin
+
@defbuiltin{bool __is_abstract (@var{type})}
If @var{type} is an abstract class ([class.abstract]) then the trait
is @code{true}, else it is @code{false}.
@@ -29589,12 +29596,6 @@ 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
-@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
-@c @code{type} or obtained from default template arguments.
-@c @enddefbuiltin
-
@defbuiltin{bool __is_empty (@var{type})}
If @code{__is_class (type)} is @code{false} then the trait is @code{false}.
Otherwise @var{type} is considered empty if and only if: @var{type}
@@ -29617,6 +29618,12 @@ is @code{true}, else it is @code{false}.
Requires: If @var{type} is a class type, it shall be a complete type.
@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
+@c @code{type} or obtained from default template arguments.
+@c @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}.
@@ -29661,13 +29668,6 @@ The underlying type of @var{type}.
Requires: @var{type} shall be an enumeration type ([dcl.enum]).
@enddefbuiltin
-@defbuiltin{bool __integer_pack (@var{length})}
-When used as the pattern of a pack expansion within a template
-definition, expands to a template argument pack containing integers
-from @code{0} to @code{@var{length}-1}. This is provided for
-efficient implementation of @code{std::make_integer_sequence}.
-@enddefbuiltin
-
@node C++ Concepts
@section C++ Concepts
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 02/11] gcc/doc/extend.texi: Add documentation for __is_array
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 03/11] gcc/doc/extend.texi: Add documentation for __is_bounded_array Ken Matsui
` (22 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_array): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index b13f9d6f934..5aeb9bdd47a 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29579,6 +29579,11 @@ 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
+@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}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 03/11] gcc/doc/extend.texi: Add documentation for __is_bounded_array
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
2024-03-02 0:22 ` [PATCH 02/11] gcc/doc/extend.texi: Add documentation for __is_array Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 04/11] gcc/doc/extend.texi: Add documentation for __is_function Ken Matsui
` (21 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_bounded_array): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 5aeb9bdd47a..4c8c0631ca7 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29596,6 +29596,11 @@ 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_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}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 04/11] gcc/doc/extend.texi: Add documentation for __is_function
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
2024-03-02 0:22 ` [PATCH 02/11] gcc/doc/extend.texi: Add documentation for __is_array Ken Matsui
2024-03-02 0:22 ` [PATCH 03/11] gcc/doc/extend.texi: Add documentation for __is_bounded_array Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 05/11] gcc/doc/extend.texi: Add documentation for __is_member_function_pointer Ken Matsui
` (20 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_function): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 4c8c0631ca7..8ad88516c04 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29628,6 +29628,11 @@ 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
+
@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
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 05/11] gcc/doc/extend.texi: Add documentation for __is_member_function_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (2 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 04/11] gcc/doc/extend.texi: Add documentation for __is_function Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 06/11] gcc/doc/extend.texi: Add documentation for __is_member_object_pointer Ken Matsui
` (19 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_member_function_pointer): New
documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 8ad88516c04..9361b425ba1 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29646,6 +29646,11 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@defbuiltin{bool __is_member_function_pointer (@var{type})}
+If @var{type} is a pointer to member function ([dcl.mptr]) the trait is
+@code{true}, else it is @code{false}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 06/11] gcc/doc/extend.texi: Add documentation for __is_member_object_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (3 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 05/11] gcc/doc/extend.texi: Add documentation for __is_member_function_pointer Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 07/11] gcc/doc/extend.texi: Add documentation for __is_member_pointer Ken Matsui
` (18 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_member_object_pointer): New
documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 9361b425ba1..df2df98567a 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29651,6 +29651,11 @@ If @var{type} is a pointer to member function ([dcl.mptr]) the trait is
@code{true}, else it is @code{false}.
@enddefbuiltin
+@defbuiltin{bool __is_member_object_pointer (@var{type})}
+If @var{type} is a pointer to member object ([dcl.mptr]) the trait is
+@code{true}, else it is @code{false}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 07/11] gcc/doc/extend.texi: Add documentation for __is_member_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (4 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 06/11] gcc/doc/extend.texi: Add documentation for __is_member_object_pointer Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 08/11] gcc/doc/extend.texi: Add documentation for __is_object Ken Matsui
` (17 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_member_pointer): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index df2df98567a..08276f734f2 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29656,6 +29656,11 @@ If @var{type} is a pointer to member object ([dcl.mptr]) the trait is
@code{true}, else it is @code{false}.
@enddefbuiltin
+@defbuiltin{bool __is_member_pointer (@var{type})}
+If @var{type} is a pointer to member ([dcl.mptr]) the trait is
+@code{true}, else it is @code{false}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 08/11] gcc/doc/extend.texi: Add documentation for __is_object
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (5 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 07/11] gcc/doc/extend.texi: Add documentation for __is_member_pointer Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 09/11] gcc/doc/extend.texi: Add documentation for __is_reference Ken Matsui
` (16 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_object): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 08276f734f2..05f864e3dd5 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29661,6 +29661,11 @@ If @var{type} is a pointer to member ([dcl.mptr]) the trait is
@code{true}, else it is @code{false}.
@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_pod (@var{type})}
If @var{type} is a cv POD type ([basic.types]) then the trait is @code{true},
else it is @code{false}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 09/11] gcc/doc/extend.texi: Add documentation for __is_reference
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (6 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 08/11] gcc/doc/extend.texi: Add documentation for __is_object Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 10/11] gcc/doc/extend.texi: Add documentation for __is_scoped_enum Ken Matsui
` (15 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_reference): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 05f864e3dd5..d36707fcdf3 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29679,6 +29679,11 @@ 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_standard_layout (@var{type})}
If @var{type} is a standard-layout type ([basic.types]) the trait is
@code{true}, else it is @code{false}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 10/11] gcc/doc/extend.texi: Add documentation for __is_scoped_enum
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (7 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 09/11] gcc/doc/extend.texi: Add documentation for __is_reference Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 0:22 ` [PATCH 11/11] gcc/doc/extend.texi: Add documentation for __remove_pointer Ken Matsui
` (14 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_scoped_enum): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index d36707fcdf3..fb2614176e5 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29684,6 +29684,11 @@ If @var{type} is a reference type ([dcl.ref]) the trait is @code{true},
else it is @code{false}.
@enddefbuiltin
+@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}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 11/11] gcc/doc/extend.texi: Add documentation for __remove_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (8 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 10/11] gcc/doc/extend.texi: Add documentation for __is_scoped_enum Ken Matsui
@ 2024-03-02 0:22 ` Ken Matsui
2024-03-02 16:00 ` [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (13 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 0:22 UTC (permalink / raw)
To: gcc-patches; +Cc: Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__remove_pointer): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index fb2614176e5..1705ed93934 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29708,6 +29708,11 @@ If @var{type} is a cv union type ([basic.compound]) the trait is
@code{true}, else it is @code{false}.
@enddefbuiltin
+@defbuiltin{@var{type} __remove_pointer (@var{type} @var{t})}
+If @var{type} is a pointer type ([dcl.ptr]) then the trait is the @var{type}
+pointed to by @var{t}, else it is @var{t}.
+@enddefbuiltin
+
@defbuiltin{bool __underlying_type (@var{type})}
The underlying type of @var{type}.
Requires: @var{type} shall be an enumeration type ([dcl.enum]).
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (9 preceding siblings ...)
2024-03-02 0:22 ` [PATCH 11/11] gcc/doc/extend.texi: Add documentation for __remove_pointer Ken Matsui
@ 2024-03-02 16:00 ` Ken Matsui
2024-03-08 16:38 ` Patrick Palka
` (12 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-02 16:00 UTC (permalink / raw)
To: Ken Matsui; +Cc: gcc-patches, W Brown
Hi Dr. Brown,
Sorry for forgetting to CC you. Could you please review my patch
series when you get a chance? This patch series adds documentation
only for built-ins I implemented. To minimize git conflicts, I will
add documentation updates to my existing patches after this patch
series gets merged. After that, I will try to add documentation to
missing built-ins that I did not implement.
Thank you!
Sincerely,
Ken Matsui
On Fri, Mar 1, 2024 at 4:23 PM Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch sorts built-in traits alphabetically for better codebase
> consistency and easier future integration of changes.
>
> gcc/ChangeLog:
>
> * doc/extend.texi (Type Traits): Sort built-in traits
> alphabetically.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
> gcc/doc/extend.texi | 62 ++++++++++++++++++++++-----------------------
> 1 file changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index f679c81acf2..b13f9d6f934 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -29499,15 +29499,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> -@defbuiltin{bool __has_nothrow_copy (@var{type})}
> -If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> -@code{true}, else if @var{type} is a cv-qualified class or union type
> -with copy constructors that are known not to throw an exception 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_nothrow_constructor (@var{type})}
> If @code{__has_trivial_constructor (type)} is @code{true} then the trait
> is @code{true}, else if @var{type} is a cv class or union type (or array
> @@ -29517,6 +29508,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> +@defbuiltin{bool __has_nothrow_copy (@var{type})}
> +If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> +@code{true}, else if @var{type} is a cv-qualified class or union type
> +with copy constructors that are known not to throw an exception 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_trivial_assign (@var{type})}
> If @var{type} is @code{const}- qualified or is a reference type then
> the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
> @@ -29527,15 +29527,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> -@defbuiltin{bool __has_trivial_copy (@var{type})}
> -If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> -type then the trait is @code{true}, else if @var{type} is a cv class
> -or union type with a trivial copy constructor ([class.copy]) 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_trivial_constructor (@var{type})}
> If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
> else if @var{type} is a cv-qualified class or union type (or array thereof)
> @@ -29545,6 +29536,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> +@defbuiltin{bool __has_trivial_copy (@var{type})}
> +If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> +type then the trait is @code{true}, else if @var{type} is a cv class
> +or union type with a trivial copy constructor ([class.copy]) 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_trivial_destructor (@var{type})}
> If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
> then the trait is @code{true}, else if @var{type} is a cv class or union
> @@ -29560,6 +29560,13 @@ If @var{type} is a class type with a virtual destructor
> Requires: If @var{type} is a non-union class type, it shall be a complete type.
> @enddefbuiltin
>
> +@defbuiltin{bool __integer_pack (@var{length})}
> +When used as the pattern of a pack expansion within a template
> +definition, expands to a template argument pack containing integers
> +from @code{0} to @code{@var{length}-1}. This is provided for
> +efficient implementation of @code{std::make_integer_sequence}.
> +@enddefbuiltin
> +
> @defbuiltin{bool __is_abstract (@var{type})}
> If @var{type} is an abstract class ([class.abstract]) then the trait
> is @code{true}, else it is @code{false}.
> @@ -29589,12 +29596,6 @@ 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
>
> -@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
> -@c @code{type} or obtained from default template arguments.
> -@c @enddefbuiltin
> -
> @defbuiltin{bool __is_empty (@var{type})}
> If @code{__is_class (type)} is @code{false} then the trait is @code{false}.
> Otherwise @var{type} is considered empty if and only if: @var{type}
> @@ -29617,6 +29618,12 @@ is @code{true}, else it is @code{false}.
> Requires: If @var{type} is a class type, it shall be a complete type.
> @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
> +@c @code{type} or obtained from default template arguments.
> +@c @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}.
> @@ -29661,13 +29668,6 @@ The underlying type of @var{type}.
> Requires: @var{type} shall be an enumeration type ([dcl.enum]).
> @enddefbuiltin
>
> -@defbuiltin{bool __integer_pack (@var{length})}
> -When used as the pattern of a pack expansion within a template
> -definition, expands to a template argument pack containing integers
> -from @code{0} to @code{@var{length}-1}. This is provided for
> -efficient implementation of @code{std::make_integer_sequence}.
> -@enddefbuiltin
> -
>
> @node C++ Concepts
> @section C++ Concepts
> --
> 2.44.0
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (10 preceding siblings ...)
2024-03-02 16:00 ` [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
@ 2024-03-08 16:38 ` Patrick Palka
2024-03-08 17:46 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 01/12] extend.texi: Arrange pre-existing " Ken Matsui
` (11 subsequent siblings)
23 siblings, 1 reply; 30+ messages in thread
From: Patrick Palka @ 2024-03-08 16:38 UTC (permalink / raw)
To: Ken Matsui; +Cc: gcc-patches, jwakely, jason
Hi Ken,
This patch series LGTM, thanks for these documentation improvements.
On Fri, 1 Mar 2024, Ken Matsui wrote:
> This patch sorts built-in traits alphabetically for better codebase
> consistency and easier future integration of changes.
>
> gcc/ChangeLog:
>
> * doc/extend.texi (Type Traits): Sort built-in traits
> alphabetically.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
> gcc/doc/extend.texi | 62 ++++++++++++++++++++++-----------------------
> 1 file changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index f679c81acf2..b13f9d6f934 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -29499,15 +29499,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> -@defbuiltin{bool __has_nothrow_copy (@var{type})}
> -If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> -@code{true}, else if @var{type} is a cv-qualified class or union type
> -with copy constructors that are known not to throw an exception 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_nothrow_constructor (@var{type})}
> If @code{__has_trivial_constructor (type)} is @code{true} then the trait
> is @code{true}, else if @var{type} is a cv class or union type (or array
> @@ -29517,6 +29508,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> +@defbuiltin{bool __has_nothrow_copy (@var{type})}
> +If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> +@code{true}, else if @var{type} is a cv-qualified class or union type
> +with copy constructors that are known not to throw an exception 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_trivial_assign (@var{type})}
> If @var{type} is @code{const}- qualified or is a reference type then
> the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
> @@ -29527,15 +29527,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> -@defbuiltin{bool __has_trivial_copy (@var{type})}
> -If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> -type then the trait is @code{true}, else if @var{type} is a cv class
> -or union type with a trivial copy constructor ([class.copy]) 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_trivial_constructor (@var{type})}
> If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
> else if @var{type} is a cv-qualified class or union type (or array thereof)
> @@ -29545,6 +29536,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> +@defbuiltin{bool __has_trivial_copy (@var{type})}
> +If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> +type then the trait is @code{true}, else if @var{type} is a cv class
> +or union type with a trivial copy constructor ([class.copy]) 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_trivial_destructor (@var{type})}
> If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
> then the trait is @code{true}, else if @var{type} is a cv class or union
> @@ -29560,6 +29560,13 @@ If @var{type} is a class type with a virtual destructor
> Requires: If @var{type} is a non-union class type, it shall be a complete type.
> @enddefbuiltin
>
> +@defbuiltin{bool __integer_pack (@var{length})}
> +When used as the pattern of a pack expansion within a template
> +definition, expands to a template argument pack containing integers
> +from @code{0} to @code{@var{length}-1}. This is provided for
> +efficient implementation of @code{std::make_integer_sequence}.
> +@enddefbuiltin
> +
> @defbuiltin{bool __is_abstract (@var{type})}
> If @var{type} is an abstract class ([class.abstract]) then the trait
> is @code{true}, else it is @code{false}.
> @@ -29589,12 +29596,6 @@ 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
>
> -@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
> -@c @code{type} or obtained from default template arguments.
> -@c @enddefbuiltin
> -
> @defbuiltin{bool __is_empty (@var{type})}
> If @code{__is_class (type)} is @code{false} then the trait is @code{false}.
> Otherwise @var{type} is considered empty if and only if: @var{type}
> @@ -29617,6 +29618,12 @@ is @code{true}, else it is @code{false}.
> Requires: If @var{type} is a class type, it shall be a complete type.
> @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
> +@c @code{type} or obtained from default template arguments.
> +@c @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}.
> @@ -29661,13 +29668,6 @@ The underlying type of @var{type}.
> Requires: @var{type} shall be an enumeration type ([dcl.enum]).
> @enddefbuiltin
>
> -@defbuiltin{bool __integer_pack (@var{length})}
> -When used as the pattern of a pack expansion within a template
> -definition, expands to a template argument pack containing integers
> -from @code{0} to @code{@var{length}-1}. This is provided for
> -efficient implementation of @code{std::make_integer_sequence}.
> -@enddefbuiltin
> -
>
> @node C++ Concepts
> @section C++ Concepts
> --
> 2.44.0
>
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically
2024-03-08 16:38 ` Patrick Palka
@ 2024-03-08 17:46 ` Ken Matsui
0 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-08 17:46 UTC (permalink / raw)
To: Patrick Palka; +Cc: Ken Matsui, gcc-patches, jwakely, jason
On Fri, Mar 8, 2024 at 8:38 AM Patrick Palka <ppalka@redhat.com> wrote:
>
> Hi Ken,
>
> This patch series LGTM, thanks for these documentation improvements.
Thank you for your time to review! I actually have some changes to
these patches, so I will re-send those to you once they are ready.
>
> On Fri, 1 Mar 2024, Ken Matsui wrote:
>
> > This patch sorts built-in traits alphabetically for better codebase
> > consistency and easier future integration of changes.
> >
> > gcc/ChangeLog:
> >
> > * doc/extend.texi (Type Traits): Sort built-in traits
> > alphabetically.
> >
> > Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> > ---
> > gcc/doc/extend.texi | 62 ++++++++++++++++++++++-----------------------
> > 1 file changed, 31 insertions(+), 31 deletions(-)
> >
> > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> > index f679c81acf2..b13f9d6f934 100644
> > --- a/gcc/doc/extend.texi
> > +++ b/gcc/doc/extend.texi
> > @@ -29499,15 +29499,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> > @code{void}, or an array of unknown bound.
> > @enddefbuiltin
> >
> > -@defbuiltin{bool __has_nothrow_copy (@var{type})}
> > -If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> > -@code{true}, else if @var{type} is a cv-qualified class or union type
> > -with copy constructors that are known not to throw an exception 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_nothrow_constructor (@var{type})}
> > If @code{__has_trivial_constructor (type)} is @code{true} then the trait
> > is @code{true}, else if @var{type} is a cv class or union type (or array
> > @@ -29517,6 +29508,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> > @code{void}, or an array of unknown bound.
> > @enddefbuiltin
> >
> > +@defbuiltin{bool __has_nothrow_copy (@var{type})}
> > +If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> > +@code{true}, else if @var{type} is a cv-qualified class or union type
> > +with copy constructors that are known not to throw an exception 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_trivial_assign (@var{type})}
> > If @var{type} is @code{const}- qualified or is a reference type then
> > the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
> > @@ -29527,15 +29527,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> > @code{void}, or an array of unknown bound.
> > @enddefbuiltin
> >
> > -@defbuiltin{bool __has_trivial_copy (@var{type})}
> > -If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> > -type then the trait is @code{true}, else if @var{type} is a cv class
> > -or union type with a trivial copy constructor ([class.copy]) 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_trivial_constructor (@var{type})}
> > If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
> > else if @var{type} is a cv-qualified class or union type (or array thereof)
> > @@ -29545,6 +29536,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> > @code{void}, or an array of unknown bound.
> > @enddefbuiltin
> >
> > +@defbuiltin{bool __has_trivial_copy (@var{type})}
> > +If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> > +type then the trait is @code{true}, else if @var{type} is a cv class
> > +or union type with a trivial copy constructor ([class.copy]) 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_trivial_destructor (@var{type})}
> > If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
> > then the trait is @code{true}, else if @var{type} is a cv class or union
> > @@ -29560,6 +29560,13 @@ If @var{type} is a class type with a virtual destructor
> > Requires: If @var{type} is a non-union class type, it shall be a complete type.
> > @enddefbuiltin
> >
> > +@defbuiltin{bool __integer_pack (@var{length})}
> > +When used as the pattern of a pack expansion within a template
> > +definition, expands to a template argument pack containing integers
> > +from @code{0} to @code{@var{length}-1}. This is provided for
> > +efficient implementation of @code{std::make_integer_sequence}.
> > +@enddefbuiltin
> > +
> > @defbuiltin{bool __is_abstract (@var{type})}
> > If @var{type} is an abstract class ([class.abstract]) then the trait
> > is @code{true}, else it is @code{false}.
> > @@ -29589,12 +29596,6 @@ 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
> >
> > -@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
> > -@c @code{type} or obtained from default template arguments.
> > -@c @enddefbuiltin
> > -
> > @defbuiltin{bool __is_empty (@var{type})}
> > If @code{__is_class (type)} is @code{false} then the trait is @code{false}.
> > Otherwise @var{type} is considered empty if and only if: @var{type}
> > @@ -29617,6 +29618,12 @@ is @code{true}, else it is @code{false}.
> > Requires: If @var{type} is a class type, it shall be a complete type.
> > @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
> > +@c @code{type} or obtained from default template arguments.
> > +@c @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}.
> > @@ -29661,13 +29668,6 @@ The underlying type of @var{type}.
> > Requires: @var{type} shall be an enumeration type ([dcl.enum]).
> > @enddefbuiltin
> >
> > -@defbuiltin{bool __integer_pack (@var{length})}
> > -When used as the pattern of a pack expansion within a template
> > -definition, expands to a template argument pack containing integers
> > -from @code{0} to @code{@var{length}-1}. This is provided for
> > -efficient implementation of @code{std::make_integer_sequence}.
> > -@enddefbuiltin
> > -
> >
> > @node C++ Concepts
> > @section C++ Concepts
> > --
> > 2.44.0
> >
> >
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 01/12] extend.texi: Arrange pre-existing built-in traits alphabetically
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (11 preceding siblings ...)
2024-03-08 16:38 ` Patrick Palka
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:38 ` Ken Matsui
` (2 more replies)
2024-03-14 7:22 ` [PATCH v2 02/12] extend.texi: Add documentation for __is_array Ken Matsui
` (10 subsequent siblings)
23 siblings, 3 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
Ok for trunk?
-- >8 --
This patch arranges pre-existing built-in traits alphabetically for
better codebase consistency and easier future integration of changes.
gcc/ChangeLog:
* doc/extend.texi (Type Traits): Arrange pre-existing built-in
traits alphabetically.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 62 ++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index f679c81acf2..b13f9d6f934 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29499,15 +29499,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
-@defbuiltin{bool __has_nothrow_copy (@var{type})}
-If @code{__has_trivial_copy (type)} is @code{true} then the trait is
-@code{true}, else if @var{type} is a cv-qualified class or union type
-with copy constructors that are known not to throw an exception 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_nothrow_constructor (@var{type})}
If @code{__has_trivial_constructor (type)} is @code{true} then the trait
is @code{true}, else if @var{type} is a cv class or union type (or array
@@ -29517,6 +29508,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@defbuiltin{bool __has_nothrow_copy (@var{type})}
+If @code{__has_trivial_copy (type)} is @code{true} then the trait is
+@code{true}, else if @var{type} is a cv-qualified class or union type
+with copy constructors that are known not to throw an exception 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_trivial_assign (@var{type})}
If @var{type} is @code{const}- qualified or is a reference type then
the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
@@ -29527,15 +29527,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
-@defbuiltin{bool __has_trivial_copy (@var{type})}
-If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
-type then the trait is @code{true}, else if @var{type} is a cv class
-or union type with a trivial copy constructor ([class.copy]) 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_trivial_constructor (@var{type})}
If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
else if @var{type} is a cv-qualified class or union type (or array thereof)
@@ -29545,6 +29536,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@defbuiltin{bool __has_trivial_copy (@var{type})}
+If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
+type then the trait is @code{true}, else if @var{type} is a cv class
+or union type with a trivial copy constructor ([class.copy]) 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_trivial_destructor (@var{type})}
If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
then the trait is @code{true}, else if @var{type} is a cv class or union
@@ -29560,6 +29560,13 @@ If @var{type} is a class type with a virtual destructor
Requires: If @var{type} is a non-union class type, it shall be a complete type.
@enddefbuiltin
+@defbuiltin{bool __integer_pack (@var{length})}
+When used as the pattern of a pack expansion within a template
+definition, expands to a template argument pack containing integers
+from @code{0} to @code{@var{length}-1}. This is provided for
+efficient implementation of @code{std::make_integer_sequence}.
+@enddefbuiltin
+
@defbuiltin{bool __is_abstract (@var{type})}
If @var{type} is an abstract class ([class.abstract]) then the trait
is @code{true}, else it is @code{false}.
@@ -29589,12 +29596,6 @@ 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
-@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
-@c @code{type} or obtained from default template arguments.
-@c @enddefbuiltin
-
@defbuiltin{bool __is_empty (@var{type})}
If @code{__is_class (type)} is @code{false} then the trait is @code{false}.
Otherwise @var{type} is considered empty if and only if: @var{type}
@@ -29617,6 +29618,12 @@ is @code{true}, else it is @code{false}.
Requires: If @var{type} is a class type, it shall be a complete type.
@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
+@c @code{type} or obtained from default template arguments.
+@c @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}.
@@ -29661,13 +29668,6 @@ The underlying type of @var{type}.
Requires: @var{type} shall be an enumeration type ([dcl.enum]).
@enddefbuiltin
-@defbuiltin{bool __integer_pack (@var{length})}
-When used as the pattern of a pack expansion within a template
-definition, expands to a template argument pack containing integers
-from @code{0} to @code{@var{length}-1}. This is provided for
-efficient implementation of @code{std::make_integer_sequence}.
-@enddefbuiltin
-
@node C++ Concepts
@section C++ Concepts
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 02/12] extend.texi: Add documentation for __is_array
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (12 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 01/12] extend.texi: Arrange pre-existing " Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 03/12] extend.texi: Add documentation for __is_bounded_array Ken Matsui
` (9 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_array): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index b13f9d6f934..5aeb9bdd47a 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29579,6 +29579,11 @@ 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
+@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}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 03/12] extend.texi: Add documentation for __is_bounded_array
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (13 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 02/12] extend.texi: Add documentation for __is_array Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 04/12] extend.texi: Add documentation for __is_function Ken Matsui
` (8 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_bounded_array): New documentation.
(__is_array): Add @anchor to get linked from
__is_bounded_array.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 5aeb9bdd47a..ae06e4da022 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29579,9 +29579,11 @@ 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
@defbuiltin{bool __is_base_of (@var{base_type}, @var{derived_type})}
@@ -29596,6 +29598,13 @@ 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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 04/12] extend.texi: Add documentation for __is_function
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (14 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 03/12] extend.texi: Add documentation for __is_bounded_array Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 05/12] extend.texi: Add documentation for __is_member_function_pointer Ken Matsui
` (7 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_function): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index ae06e4da022..a94ad7955fe 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29632,6 +29632,11 @@ 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
+
@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
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 05/12] extend.texi: Add documentation for __is_member_function_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (15 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 04/12] extend.texi: Add documentation for __is_function Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 06/12] extend.texi: Add documentation for __is_member_object_pointer Ken Matsui
` (6 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_member_function_pointer): New
documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index a94ad7955fe..f08574318d0 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29650,6 +29650,11 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@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}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 06/12] extend.texi: Add documentation for __is_member_object_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (16 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 05/12] extend.texi: Add documentation for __is_member_function_pointer Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 07/12] extend.texi: Add documentation for __is_member_pointer Ken Matsui
` (5 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_member_object_pointer): New
documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index f08574318d0..7644ea5b80b 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29655,6 +29655,11 @@ If @var{type} is a pointer to member function type ([dcl.mptr]) the trait is
@code{true}, else it is @code{false}.
@enddefbuiltin
+@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}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 07/12] extend.texi: Add documentation for __is_member_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (17 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 06/12] extend.texi: Add documentation for __is_member_object_pointer Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 08/12] extend.texi: Add documentation for __is_object Ken Matsui
` (4 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_member_pointer): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 7644ea5b80b..86ac0c7ed07 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29660,6 +29660,11 @@ If @var{type} is a pointer to member object type ([dcl.mptr]) the trait is
@code{true}, else it is @code{false}.
@enddefbuiltin
+@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}.
+@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 08/12] extend.texi: Add documentation for __is_object
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (18 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 07/12] extend.texi: Add documentation for __is_member_pointer Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 09/12] extend.texi: Add documentation for __is_reference Ken Matsui
` (3 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_object): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 86ac0c7ed07..293eb5706f9 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29665,6 +29665,11 @@ If @var{type} is a pointer to member type ([dcl.mptr]) the trait is
@code{true}, else it is @code{false}.
@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_pod (@var{type})}
If @var{type} is a cv POD type ([basic.types]) then the trait is @code{true},
else it is @code{false}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 09/12] extend.texi: Add documentation for __is_reference
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (19 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 08/12] extend.texi: Add documentation for __is_object Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 10/12] extend.texi: Add documentation for __is_scoped_enum Ken Matsui
` (2 subsequent siblings)
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_reference): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 293eb5706f9..6af5294c7b0 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29683,6 +29683,11 @@ 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_standard_layout (@var{type})}
If @var{type} is a standard-layout type ([basic.types]) the trait is
@code{true}, else it is @code{false}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 10/12] extend.texi: Add documentation for __is_scoped_enum
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (20 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 09/12] extend.texi: Add documentation for __is_reference Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 11/12] extend.texi: Add documentation for __remove_pointer Ken Matsui
2024-03-14 7:22 ` [PATCH v2 12/12] extend.texi: Add subsections for type- and expression-yielding traits Ken Matsui
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__is_scoped_enum): New documentation.
(__is_enum): Add @anchor to get linked from __is_scoped_enum.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 6af5294c7b0..e4a4060be2b 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29621,9 +29621,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})}
@@ -29688,6 +29690,13 @@ If @var{type} is a reference type ([dcl.ref]) the trait is @code{true},
else it is @code{false}.
@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}.
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 11/12] extend.texi: Add documentation for __remove_pointer
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (21 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 10/12] extend.texi: Add documentation for __is_scoped_enum Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 12/12] extend.texi: Add subsections for type- and expression-yielding traits Ken Matsui
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (__remove_pointer): New documentation.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index e4a4060be2b..10ddf50182d 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29716,6 +29716,11 @@ If @var{type} is a cv union type ([basic.compound]) the trait is
@code{true}, else it is @code{false}.
@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
+
@defbuiltin{bool __underlying_type (@var{type})}
The underlying type of @var{type}.
Requires: @var{type} shall be an enumeration type ([dcl.enum]).
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 12/12] extend.texi: Add subsections for type- and expression-yielding traits
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
` (22 preceding siblings ...)
2024-03-14 7:22 ` [PATCH v2 11/12] extend.texi: Add documentation for __remove_pointer Ken Matsui
@ 2024-03-14 7:22 ` Ken Matsui
23 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:22 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
gcc/ChangeLog:
* doc/extend.texi (Expression-yielding Type Traits): New
subsection.
(Type-yielding Type Traits): Likewise.
(__remove_pointer): Move under the Type-yielding Type Traits
subsection.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 10ddf50182d..5d0afbe9611 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29488,6 +29488,11 @@ 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)}
@@ -29716,16 +29721,19 @@ If @var{type} is a cv union type ([basic.compound]) the trait is
@code{true}, else it is @code{false}.
@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
-
@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.
+
+@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
@node C++ Concepts
@section C++ Concepts
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 01/12] extend.texi: Arrange pre-existing built-in traits alphabetically
2024-03-14 7:22 ` [PATCH v2 01/12] extend.texi: Arrange pre-existing " Ken Matsui
@ 2024-03-14 7:38 ` Ken Matsui
2024-03-15 7:20 ` [PATCH v3 1/2] " Ken Matsui
2024-03-15 7:20 ` [PATCH v3 2/2] extend.texi: Add documentation for all missing built-in traits [PR87343] Ken Matsui
2 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-14 7:38 UTC (permalink / raw)
To: Ken Matsui; +Cc: gcc-patches, jason, ppalka
On Thu, Mar 14, 2024 at 12:28 AM Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> Ok for trunk?
It appears that my update notes have somehow vanished. I have
rectified several inconsistencies and introduced sub-sections to
enhance readability. Although I contemplated merging certain patches
for a more streamlined presentation, I ultimately opted to maintain
the existing structure of commits, believing it to better suit our
commit granularity.
>
> -- >8 --
>
> This patch arranges pre-existing built-in traits alphabetically for
> better codebase consistency and easier future integration of changes.
>
> gcc/ChangeLog:
>
> * doc/extend.texi (Type Traits): Arrange pre-existing built-in
> traits alphabetically.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
> gcc/doc/extend.texi | 62 ++++++++++++++++++++++-----------------------
> 1 file changed, 31 insertions(+), 31 deletions(-)
>
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index f679c81acf2..b13f9d6f934 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -29499,15 +29499,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> -@defbuiltin{bool __has_nothrow_copy (@var{type})}
> -If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> -@code{true}, else if @var{type} is a cv-qualified class or union type
> -with copy constructors that are known not to throw an exception 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_nothrow_constructor (@var{type})}
> If @code{__has_trivial_constructor (type)} is @code{true} then the trait
> is @code{true}, else if @var{type} is a cv class or union type (or array
> @@ -29517,6 +29508,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> +@defbuiltin{bool __has_nothrow_copy (@var{type})}
> +If @code{__has_trivial_copy (type)} is @code{true} then the trait is
> +@code{true}, else if @var{type} is a cv-qualified class or union type
> +with copy constructors that are known not to throw an exception 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_trivial_assign (@var{type})}
> If @var{type} is @code{const}- qualified or is a reference type then
> the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
> @@ -29527,15 +29527,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> -@defbuiltin{bool __has_trivial_copy (@var{type})}
> -If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> -type then the trait is @code{true}, else if @var{type} is a cv class
> -or union type with a trivial copy constructor ([class.copy]) 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_trivial_constructor (@var{type})}
> If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
> else if @var{type} is a cv-qualified class or union type (or array thereof)
> @@ -29545,6 +29536,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
> @code{void}, or an array of unknown bound.
> @enddefbuiltin
>
> +@defbuiltin{bool __has_trivial_copy (@var{type})}
> +If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
> +type then the trait is @code{true}, else if @var{type} is a cv class
> +or union type with a trivial copy constructor ([class.copy]) 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_trivial_destructor (@var{type})}
> If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
> then the trait is @code{true}, else if @var{type} is a cv class or union
> @@ -29560,6 +29560,13 @@ If @var{type} is a class type with a virtual destructor
> Requires: If @var{type} is a non-union class type, it shall be a complete type.
> @enddefbuiltin
>
> +@defbuiltin{bool __integer_pack (@var{length})}
> +When used as the pattern of a pack expansion within a template
> +definition, expands to a template argument pack containing integers
> +from @code{0} to @code{@var{length}-1}. This is provided for
> +efficient implementation of @code{std::make_integer_sequence}.
> +@enddefbuiltin
> +
> @defbuiltin{bool __is_abstract (@var{type})}
> If @var{type} is an abstract class ([class.abstract]) then the trait
> is @code{true}, else it is @code{false}.
> @@ -29589,12 +29596,6 @@ 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
>
> -@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
> -@c @code{type} or obtained from default template arguments.
> -@c @enddefbuiltin
> -
> @defbuiltin{bool __is_empty (@var{type})}
> If @code{__is_class (type)} is @code{false} then the trait is @code{false}.
> Otherwise @var{type} is considered empty if and only if: @var{type}
> @@ -29617,6 +29618,12 @@ is @code{true}, else it is @code{false}.
> Requires: If @var{type} is a class type, it shall be a complete type.
> @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
> +@c @code{type} or obtained from default template arguments.
> +@c @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}.
> @@ -29661,13 +29668,6 @@ The underlying type of @var{type}.
> Requires: @var{type} shall be an enumeration type ([dcl.enum]).
> @enddefbuiltin
>
> -@defbuiltin{bool __integer_pack (@var{length})}
> -When used as the pattern of a pack expansion within a template
> -definition, expands to a template argument pack containing integers
> -from @code{0} to @code{@var{length}-1}. This is provided for
> -efficient implementation of @code{std::make_integer_sequence}.
> -@enddefbuiltin
> -
>
> @node C++ Concepts
> @section C++ Concepts
> --
> 2.44.0
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v3 1/2] extend.texi: Arrange pre-existing built-in traits alphabetically
2024-03-14 7:22 ` [PATCH v2 01/12] extend.texi: Arrange pre-existing " Ken Matsui
2024-03-14 7:38 ` Ken Matsui
@ 2024-03-15 7:20 ` Ken Matsui
2024-03-15 7:20 ` [PATCH v3 2/2] extend.texi: Add documentation for all missing built-in traits [PR87343] Ken Matsui
2 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-15 7:20 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
Consolidated most patches into one for easier review and added
documentation for all missing built-in traits.
Ok for trunk?
-- >8 --
This patch arranges pre-existing built-in traits alphabetically for
better codebase consistency and easier future integration of changes.
gcc/ChangeLog:
* doc/extend.texi (Type Traits): Arrange pre-existing built-in
traits alphabetically.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 50 ++++++++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index df0982fdfda..1c61682b102 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29500,15 +29500,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
-@defbuiltin{bool __has_nothrow_copy (@var{type})}
-If @code{__has_trivial_copy (type)} is @code{true} then the trait is
-@code{true}, else if @var{type} is a cv-qualified class or union type
-with copy constructors that are known not to throw an exception 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_nothrow_constructor (@var{type})}
If @code{__has_trivial_constructor (type)} is @code{true} then the trait
is @code{true}, else if @var{type} is a cv class or union type (or array
@@ -29518,6 +29509,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@defbuiltin{bool __has_nothrow_copy (@var{type})}
+If @code{__has_trivial_copy (type)} is @code{true} then the trait is
+@code{true}, else if @var{type} is a cv-qualified class or union type
+with copy constructors that are known not to throw an exception 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_trivial_assign (@var{type})}
If @var{type} is @code{const}- qualified or is a reference type then
the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
@@ -29528,15 +29528,6 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
-@defbuiltin{bool __has_trivial_copy (@var{type})}
-If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
-type then the trait is @code{true}, else if @var{type} is a cv class
-or union type with a trivial copy constructor ([class.copy]) 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_trivial_constructor (@var{type})}
If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
else if @var{type} is a cv-qualified class or union type (or array thereof)
@@ -29546,6 +29537,15 @@ Requires: @var{type} shall be a complete type, (possibly cv-qualified)
@code{void}, or an array of unknown bound.
@enddefbuiltin
+@defbuiltin{bool __has_trivial_copy (@var{type})}
+If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
+type then the trait is @code{true}, else if @var{type} is a cv class
+or union type with a trivial copy constructor ([class.copy]) 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_trivial_destructor (@var{type})}
If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
then the trait is @code{true}, else if @var{type} is a cv class or union
@@ -29561,6 +29561,13 @@ If @var{type} is a class type with a virtual destructor
Requires: If @var{type} is a non-union class type, it shall be a complete type.
@enddefbuiltin
+@defbuiltin{bool __integer_pack (@var{length})}
+When used as the pattern of a pack expansion within a template
+definition, expands to a template argument pack containing integers
+from @code{0} to @code{@var{length}-1}. This is provided for
+efficient implementation of @code{std::make_integer_sequence}.
+@enddefbuiltin
+
@defbuiltin{bool __is_abstract (@var{type})}
If @var{type} is an abstract class ([class.abstract]) then the trait
is @code{true}, else it is @code{false}.
@@ -29662,13 +29669,6 @@ The underlying type of @var{type}.
Requires: @var{type} shall be an enumeration type ([dcl.enum]).
@enddefbuiltin
-@defbuiltin{bool __integer_pack (@var{length})}
-When used as the pattern of a pack expansion within a template
-definition, expands to a template argument pack containing integers
-from @code{0} to @code{@var{length}-1}. This is provided for
-efficient implementation of @code{std::make_integer_sequence}.
-@enddefbuiltin
-
@node C++ Concepts
@section C++ Concepts
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v3 2/2] extend.texi: Add documentation for all missing built-in traits [PR87343]
2024-03-14 7:22 ` [PATCH v2 01/12] extend.texi: Arrange pre-existing " Ken Matsui
2024-03-14 7:38 ` Ken Matsui
2024-03-15 7:20 ` [PATCH v3 1/2] " Ken Matsui
@ 2024-03-15 7:20 ` Ken Matsui
2024-03-16 9:47 ` [PATCH v4 " Ken Matsui
2 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-03-15 7:20 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
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 <kmatsui@gcc.gnu.org>
---
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
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v4 2/2] extend.texi: Add documentation for all missing built-in traits [PR87343]
2024-03-15 7:20 ` [PATCH v3 2/2] extend.texi: Add documentation for all missing built-in traits [PR87343] Ken Matsui
@ 2024-03-16 9:47 ` Ken Matsui
0 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-03-16 9:47 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, ppalka, Ken Matsui
Fixed some wording and consistency issues in the documentation.
-- >8 --
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.
(__is_enum): Add @anchor and @ref to related traits.
(__is_trivial): Likewise.
(__is_class): Fix documentation.
(__underlying_type): Likewise.
(__has_nothrow_assign): Ensure consistency.
(__has_trivial_constructor): Likewise.
(__has_trivial_copy): Likewise.
(__has_trivial_assign): Likewise.
(__has_trivial_constructor): Likewise.
(__has_trivial_copy): Likewise.
(__has_trivial_destructor): Likewise.
(__has_virtual_destructor): Likewise.
(__is_abstract): Likewise.
(__is_aggregate): Likewise.
(__is_base_of): Likewise.
(__is_empty): Likewise.
(__is_enum): Likewise.
(__is_literal_type): Likewise.
(__is_pod): Likewise.
(__is_polymorphic): Likewise.
(__is_standard_layout): Likewise.
(__is_trivial): Likewise.
(__is_union): Likewise.
(__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.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
gcc/doc/extend.texi | 355 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 304 insertions(+), 51 deletions(-)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 1c61682b102..eb61f619e02 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -29485,79 +29485,91 @@ Function Multiversioning} for more details.
@section Type Traits
The C++ front end implements syntactic extensions that allow
-compile-time determination of
-various characteristics of a type (or of a
-pair of types).
+compile-time determination of various characteristics of a type
+(or of a pair of types).
+
+
+@subsection Value-yielding Type Traits
+
+Most of these built-ins return a @code{bool} result when invoked; the rest
+yields a @code{size_t} value.
@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)}
-is @code{true} then the trait is @code{true}, else if @var{type} is
+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)}
+is @code{true}, then the trait is @code{true}, else if @var{type} is
a cv-qualified class or union type with copy assignment operators that are
-known not to throw an exception then the trait is @code{true}, else it is
+known not to throw an exception, 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_nothrow_constructor (@var{type})}
-If @code{__has_trivial_constructor (type)} is @code{true} then the trait
+If @code{__has_trivial_constructor (type)} is @code{true}, then the trait
is @code{true}, else if @var{type} is a cv class or union type (or array
thereof) with a default constructor that is known not to throw an
-exception then the trait is @code{true}, else it is @code{false}.
+exception, 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_nothrow_copy (@var{type})}
-If @code{__has_trivial_copy (type)} is @code{true} then the trait is
+If @code{__has_trivial_copy (type)} is @code{true}, then the trait is
@code{true}, else if @var{type} is a cv-qualified class or union type
-with copy constructors that are known not to throw an exception then
+with copy constructors that are known not to throw an exception, 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_trivial_assign (@var{type})}
-If @var{type} is @code{const}- qualified or is a reference type then
+If @var{type} is @code{const}-qualified or is a reference type, then
the trait is @code{false}. Otherwise if @code{__is_trivial (type)} is
-@code{true} then the trait is @code{true}, else if @var{type} is
+@code{true}, then the trait is @code{true}, else if @var{type} is
a cv-qualified class or union type with a trivial copy assignment
-([class.copy]) then the trait is @code{true}, else it is @code{false}.
+([class.copy]), 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_trivial_constructor (@var{type})}
-If @code{__is_trivial (type)} is @code{true} then the trait is @code{true},
+If @code{__is_trivial (type)} is @code{true}, then the trait is @code{true},
else if @var{type} is a cv-qualified class or union type (or array thereof)
-with a trivial default constructor ([class.ctor]) then the trait is @code{true},
-else it is @code{false}.
+with a trivial default constructor ([class.ctor]), 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_trivial_copy (@var{type})}
If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference
-type then the trait is @code{true}, else if @var{type} is a cv class
-or union type with a trivial copy constructor ([class.copy]) 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.
+type, then the trait is @code{true}, else if @var{type} is a cv class
+or union type with a trivial copy constructor ([class.copy]), 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_trivial_destructor (@var{type})}
-If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type
+If @code{__is_trivial (type)} is @code{true} or @var{type} is a reference type,
then the trait is @code{true}, else if @var{type} is a cv class or union
-type (or array thereof) with a trivial destructor ([class.dtor]) then
+type (or array thereof) with a trivial destructor ([class.dtor]), 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_unique_object_representations (@var{type})}
+If @code{__is_trivially_copyable (type)} is @code{true} and @var{type}
+has no padding bits, 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}.
+([class.dtor]), then the trait 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
@@ -29569,20 +29581,36 @@ efficient implementation of @code{std::make_integer_sequence}.
@enddefbuiltin
@defbuiltin{bool __is_abstract (@var{type})}
-If @var{type} is an abstract class ([class.abstract]) then the trait
+If @var{type} is an abstract class ([class.abstract]), then the trait
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_aggregate (@var{type})}
-If @var{type} is an aggregate type ([dcl.init.aggr]) the trait is
+If @var{type} is an aggregate type ([dcl.init.aggr]), then the trait is
@code{true}, else it is @code{false}.
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]), then 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 @var{type2} of an assignment
+operator's right operand, 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}.
+([class.derived]), then the trait is @code{true}, else it is @code{false}.
Top-level cv-qualifications of @var{base_type} and
@var{derived_type} are ignored. For the purposes of this trait, a
class type is considered is own base.
@@ -29592,9 +29620,35 @@ 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]), then
+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}.
+If @var{type} is a (possibly cv-qualified) non-union class type
+([basic.compound]), then 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: Each of @var{type} or @var{arg_types}... being a class type
+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 a value of @var{from_type} can be implicitly converted to a value of
+@var{to_type}, then the trait is @code{true}, else it is @code{false}.
+Requires: Each of @var{from_type} or @var{to_type} being a class type
+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.
@@ -29604,8 +29658,8 @@ If @var{type} is a cv-qualified class type, and not a union type
@c @enddefbuiltin
@defbuiltin{bool __is_empty (@var{type})}
-If @code{__is_class (type)} is @code{false} then the trait is @code{false}.
-Otherwise @var{type} is considered empty if and only if: @var{type}
+If @code{__is_class (type)} is @code{false}, then the trait is @code{false}.
+Otherwise, @var{type} is considered empty if and only if: @var{type}
has no non-static data members, or all non-static data members, if
any, are bit-fields of length 0, and @var{type} has no virtual
members, and @var{type} has no virtual base classes, and @var{type}
@@ -29614,9 +29668,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
+If @var{type} is a cv enumeration type ([basic.compound]), then the trait is
@code{true}, else it is @code{false}.
+See also: @ref{__is_scoped_enum}.
@enddefbuiltin
@defbuiltin{bool __is_final (@var{type})}
@@ -29625,48 +29681,254 @@ 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]), then 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
+If @var{type} is a literal type ([basic.types]), 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
+@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]), then
+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]), then
+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]), then 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: Each of @var{type1} or @var{type2} being a class type
+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: Each of @var{type} or @var{arg_types}... being a class type
+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: Each of @var{from_type} or @var{to_type} being a class type
+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]), then 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},
+If @var{type} is a cv POD type ([basic.types]), 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 __is_polymorphic (@var{type})}
-If @var{type} is a polymorphic class ([class.virtual]) then the trait
+If @var{type} is a polymorphic class ([class.virtual]), then the trait
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]), then the trait is @code{true},
+else it is @code{false}.
+@enddefbuiltin
+
+@defbuiltin{bool __is_same (@var{type1}, @var{type2})}
+If @var{type1} and @var{type2} refer to the same type, then the trait is
+@code{true}, else it is @code{false}.
+@enddefbuiltin
+
+@anchor{__is_scoped_enum}
+@defbuiltin{bool __is_scoped_enum (@var{type})}
+If @var{type} is a scoped enumeration type ([dcl.enum]), then 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
+If @var{type} is a standard-layout type ([basic.types]), then 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}.
@enddefbuiltin
+@anchor{__is_trivial}
@defbuiltin{bool __is_trivial (@var{type})}
-If @var{type} is a trivial type ([basic.types]) the trait is
+If @var{type} is a trivial type ([basic.types]), then 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: Each of @var{type1} or @var{type2} being a class type
+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: Each of @var{type} or @var{arg_types}... being a class type
+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]), then 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})}
-If @var{type} is a cv union type ([basic.compound]) the trait is
+If @var{type} is a cv union type ([basic.compound]), then the trait is
@code{true}, else it is @code{false}.
@enddefbuiltin
-@defbuiltin{bool __underlying_type (@var{type})}
-The underlying type of @var{type}.
-Requires: @var{type} shall be an enumeration type ([dcl.enum]).
+@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: Each of @var{type1} or @var{type2} being a class type 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: Each of @var{type1} or @var{type2} being a class type shall be
+a complete type.
+See also: @ref{__reference_constructs_from_temporary}
+@enddefbuiltin
+
+
+@subsection Type-yielding Type Traits
+
+Most of these built-ins return a type when invoked; the rest yields
+a list of types.
+
+@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 @code{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
@@ -29708,15 +29970,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
--
2.44.0
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2024-03-16 9:49 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-02 0:22 [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
2024-03-02 0:22 ` [PATCH 02/11] gcc/doc/extend.texi: Add documentation for __is_array Ken Matsui
2024-03-02 0:22 ` [PATCH 03/11] gcc/doc/extend.texi: Add documentation for __is_bounded_array Ken Matsui
2024-03-02 0:22 ` [PATCH 04/11] gcc/doc/extend.texi: Add documentation for __is_function Ken Matsui
2024-03-02 0:22 ` [PATCH 05/11] gcc/doc/extend.texi: Add documentation for __is_member_function_pointer Ken Matsui
2024-03-02 0:22 ` [PATCH 06/11] gcc/doc/extend.texi: Add documentation for __is_member_object_pointer Ken Matsui
2024-03-02 0:22 ` [PATCH 07/11] gcc/doc/extend.texi: Add documentation for __is_member_pointer Ken Matsui
2024-03-02 0:22 ` [PATCH 08/11] gcc/doc/extend.texi: Add documentation for __is_object Ken Matsui
2024-03-02 0:22 ` [PATCH 09/11] gcc/doc/extend.texi: Add documentation for __is_reference Ken Matsui
2024-03-02 0:22 ` [PATCH 10/11] gcc/doc/extend.texi: Add documentation for __is_scoped_enum Ken Matsui
2024-03-02 0:22 ` [PATCH 11/11] gcc/doc/extend.texi: Add documentation for __remove_pointer Ken Matsui
2024-03-02 16:00 ` [PATCH 01/11] gcc/doc/extend.texi: Sort built-in traits alphabetically Ken Matsui
2024-03-08 16:38 ` Patrick Palka
2024-03-08 17:46 ` Ken Matsui
2024-03-14 7:22 ` [PATCH v2 01/12] extend.texi: Arrange pre-existing " Ken Matsui
2024-03-14 7:38 ` Ken Matsui
2024-03-15 7:20 ` [PATCH v3 1/2] " Ken Matsui
2024-03-15 7:20 ` [PATCH v3 2/2] extend.texi: Add documentation for all missing built-in traits [PR87343] Ken Matsui
2024-03-16 9:47 ` [PATCH v4 " Ken Matsui
2024-03-14 7:22 ` [PATCH v2 02/12] extend.texi: Add documentation for __is_array Ken Matsui
2024-03-14 7:22 ` [PATCH v2 03/12] extend.texi: Add documentation for __is_bounded_array Ken Matsui
2024-03-14 7:22 ` [PATCH v2 04/12] extend.texi: Add documentation for __is_function Ken Matsui
2024-03-14 7:22 ` [PATCH v2 05/12] extend.texi: Add documentation for __is_member_function_pointer Ken Matsui
2024-03-14 7:22 ` [PATCH v2 06/12] extend.texi: Add documentation for __is_member_object_pointer Ken Matsui
2024-03-14 7:22 ` [PATCH v2 07/12] extend.texi: Add documentation for __is_member_pointer Ken Matsui
2024-03-14 7:22 ` [PATCH v2 08/12] extend.texi: Add documentation for __is_object Ken Matsui
2024-03-14 7:22 ` [PATCH v2 09/12] extend.texi: Add documentation for __is_reference Ken Matsui
2024-03-14 7:22 ` [PATCH v2 10/12] extend.texi: Add documentation for __is_scoped_enum Ken Matsui
2024-03-14 7:22 ` [PATCH v2 11/12] extend.texi: Add documentation for __remove_pointer Ken Matsui
2024-03-14 7:22 ` [PATCH v2 12/12] extend.texi: Add subsections for type- and expression-yielding traits Ken Matsui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).