From 4d4566c32e0c4dc988e883bd3a1c303b3b475bda Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 8 Mar 2023 23:53:21 -0500 Subject: [PATCH] c++: hide __is_deducible for GCC 13 To: gcc-patches@gcc.gnu.org I want to have more discussion about the interface before claiming the __is_deducible name, so for GCC 13 make it internal-only. gcc/ChangeLog: * doc/extend.texi: Comment out __is_deducible docs. gcc/cp/ChangeLog: * cp-trait.def (IS_DEDUCIBLE): Add space to name. gcc/testsuite/ChangeLog: * g++.dg/ext/is_deducible1.C: Guard with __has_builtin (__is_deducible). --- gcc/doc/extend.texi | 7 ++++--- gcc/testsuite/g++.dg/ext/is_deducible1.C | 6 +++++- gcc/cp/cp-trait.def | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index b64a85722db..9dcfc860108 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -25213,9 +25213,10 @@ type. A diagnostic is produced if this requirement is not met. If @code{type} is a cv-qualified class type, and not a union type ([basic.compound]) the trait is @code{true}, else it is @code{false}. -@item __is_deducible (template, type) -If template arguments for @code{template} can be deduced from -@code{type} or obtained from default template arguments. +@c FIXME Commented out for GCC 13, discuss user interface for GCC 14. +@c @item __is_deducible (template, type) +@c If template arguments for @code{template} can be deduced from +@c @code{type} or obtained from default template arguments. @item __is_empty (type) If @code{__is_class (type)} is @code{false} then the trait is @code{false}. diff --git a/gcc/testsuite/g++.dg/ext/is_deducible1.C b/gcc/testsuite/g++.dg/ext/is_deducible1.C index 30cbe089f50..6873e4f4c2e 100644 --- a/gcc/testsuite/g++.dg/ext/is_deducible1.C +++ b/gcc/testsuite/g++.dg/ext/is_deducible1.C @@ -1,5 +1,7 @@ // { dg-do compile { target c++20 } } +#if __has_builtin (__is_deducible) + template struct A { }; template struct B { }; @@ -26,6 +28,8 @@ static_assert (__is_deducible (D, D)); template using E = int[N]; static_assert (__is_deducible (E, int[42])); +#endif // __has_builtin (__is_deducible) + // We don't try to support this. template void f(T); -bool b = __is_deducible (f, void (int)); // { dg-error "class or alias" } +bool b = __is_deducible (f, void (int)); // { dg-error "" } diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def index e43fb464f42..bac593c0094 100644 --- a/gcc/cp/cp-trait.def +++ b/gcc/cp/cp-trait.def @@ -84,7 +84,8 @@ DEFTRAIT_EXPR (IS_TRIVIALLY_COPYABLE, "__is_trivially_copyable", 1) DEFTRAIT_EXPR (IS_UNION, "__is_union", 1) DEFTRAIT_EXPR (REF_CONSTRUCTS_FROM_TEMPORARY, "__reference_constructs_from_temporary", 2) DEFTRAIT_EXPR (REF_CONVERTS_FROM_TEMPORARY, "__reference_converts_from_temporary", 2) -DEFTRAIT_EXPR (IS_DEDUCIBLE, "__is_deducible", 2) +/* FIXME Added space to avoid direct usage in GCC 13. */ +DEFTRAIT_EXPR (IS_DEDUCIBLE, "__is_deducible ", 2) DEFTRAIT_TYPE (REMOVE_CV, "__remove_cv", 1) DEFTRAIT_TYPE (REMOVE_REFERENCE, "__remove_reference", 1) -- 2.31.1