Skip to content

Commit

Permalink
c++: hide __is_deducible for GCC 13
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
jicama committed Mar 9, 2023
1 parent 148cbb1 commit 30556bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion gcc/cp/cp-trait.def
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions gcc/doc/extend.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
6 changes: 5 additions & 1 deletion gcc/testsuite/g++.dg/ext/is_deducible1.C
Original file line number Diff line number Diff line change
@@ -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 { };

Expand All @@ -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 "" }

0 comments on commit 30556bf

Please sign in to comment.