aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2024-07-03 17:27:48 -0400
committerJason Merrill <jason@redhat.com>2024-07-03 22:04:50 -0400
commit655fe94ae4c95d7f113c62787ca382d2742fad6f (patch)
tree9d4b5fedd187060970ba885f888f5187e2ccd342 /gcc
parentd1eeafe40f263acdb5eb1b57f777e064a11ced2b (diff)
downloadgcc-655fe94ae4c95d7f113c62787ca382d2742fad6f.zip
gcc-655fe94ae4c95d7f113c62787ca382d2742fad6f.tar.gz
gcc-655fe94ae4c95d7f113c62787ca382d2742fad6f.tar.bz2
c++: CTAD and trait built-ins
While poking at 101232 I noticed that we started trying to parse __is_invocable(_Fn, _Args...) as a functional cast to a CTAD placeholder type; we shouldn't consider CTAD for a template that shares a name (reserved for the implementation) with a built-in trait. gcc/cp/ChangeLog: * pt.cc (ctad_template_p): Return false for trait names.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/pt.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 017cc7f..d131648 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -30812,6 +30812,11 @@ ctad_template_p (tree tmpl)
template-name of the simple-template-id names a deducible template. */
if (DECL_CLASS_TEMPLATE_P (tmpl)
+ && IDENTIFIER_TRAIT_P (DECL_NAME (tmpl)))
+ /* Don't consider CTAD for templates with the same name as a trait; that
+ is ambiguous with e.g. __is_invocable(_Fn,_Args...). */
+ return false;
+ if (DECL_CLASS_TEMPLATE_P (tmpl)
|| DECL_TEMPLATE_TEMPLATE_PARM_P (tmpl))
return true;
if (!DECL_ALIAS_TEMPLATE_P (tmpl))