diff options
author | Jason Merrill <jason@redhat.com> | 2023-03-08 23:53:21 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-03-09 10:25:45 -0500 |
commit | 30556bf81f4385c2a9c449948865dbcf35664764 (patch) | |
tree | 983e2d0a04bed217b1fa69111ca50ea16ef5fcec | |
parent | 148cbb153dafd6b21d83c00787acd430aec68a3d (diff) | |
download | gcc-30556bf81f4385c2a9c449948865dbcf35664764.zip gcc-30556bf81f4385c2a9c449948865dbcf35664764.tar.gz gcc-30556bf81f4385c2a9c449948865dbcf35664764.tar.bz2 |
c++: hide __is_deducible for GCC 13
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).
-rw-r--r-- | gcc/cp/cp-trait.def | 3 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/is_deducible1.C | 6 |
3 files changed, 11 insertions, 5 deletions
diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def index e43fb46..bac593c 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) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index b64a857..9dcfc86 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 30cbe08..6873e4f 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 <class T> struct A { }; template <class T> struct B { }; @@ -26,6 +28,8 @@ static_assert (__is_deducible (D, D<int>)); template <class T, T N> using E = int[N]; static_assert (__is_deducible (E, int[42])); +#endif // __has_builtin (__is_deducible) + // We don't try to support this. template <class T> void f(T); -bool b = __is_deducible (f, void (int)); // { dg-error "class or alias" } +bool b = __is_deducible (f, void (int)); // { dg-error "" } |