]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++/reflection: tweak reflection_function_template_p
authorMarek Polacek <polacek@redhat.com>
Thu, 16 Apr 2026 20:43:42 +0000 (16:43 -0400)
committerMarek Polacek <polacek@redhat.com>
Fri, 17 Apr 2026 15:19:37 +0000 (11:19 -0400)
...to use the narrower DECL_FUNCTION_TEMPLATE_P instead of
really_overloaded_fn.  Also make the parameter const_tree.

gcc/cp/ChangeLog:

* cp-tree.h (reflection_function_template_p): Change the
parameter to const_tree.
* reflect.cc (valid_splice_for_member_access_p): Use
reflection_function_template_p.
(reflection_function_template_p): Check DECL_FUNCTION_TEMPLATE_P
instead of really_overloaded_fn.  Unwrap BASELINKs and OVERLOADs.
Adjust the parameter type.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/cp-tree.h
gcc/cp/reflect.cc

index abefbc3358f25f8045989ac4e31615fff3b5f458..ff8fcca72fed49585006d95200966a45f77f8975 100644 (file)
@@ -9452,7 +9452,7 @@ extern tree make_splice_scope (tree, bool);
 extern bool dependent_splice_p (const_tree) ATTRIBUTE_PURE;
 extern tree reflection_mangle_prefix (tree, char [3]);
 extern void check_consteval_only_fn (tree);
-extern bool reflection_function_template_p (tree) ATTRIBUTE_PURE;
+extern bool reflection_function_template_p (const_tree) ATTRIBUTE_PURE;
 extern void dump_data_member_spec (pretty_printer *, tree);
 
 /* Inline bodies.  */
index 59f8354a3cf132b3fd328a9df718fb7414ca10d9..97b6e76c65283df9b1716701092aa9ea8cb2ef79 100644 (file)
@@ -8919,7 +8919,7 @@ valid_splice_for_member_access_p (const_tree t, bool decls_only_p/*=true*/)
       || VAR_P (t)
       || TREE_CODE (t) == CONST_DECL
       || TREE_CODE (t) == FUNCTION_DECL
-      || DECL_FUNCTION_TEMPLATE_P (OVL_FIRST (const_cast<tree> (t)))
+      || reflection_function_template_p (t)
       || variable_template_p (const_cast<tree> (t)))
     return true;
 
@@ -9324,9 +9324,10 @@ reflection_mangle_prefix (tree refl, char prefix[3])
 /* Returns true iff X is a reflection of a function template.  */
 
 bool
-reflection_function_template_p (tree x)
+reflection_function_template_p (const_tree x)
 {
-  return really_overloaded_fn (x);
+  return (DECL_FUNCTION_TEMPLATE_P
+         (OVL_FIRST (MAYBE_BASELINK_FUNCTIONS (const_cast<tree> (x)))));
 }
 
 #include "gt-cp-reflect.h"