From: Marek Polacek Date: Thu, 16 Apr 2026 20:43:42 +0000 (-0400) Subject: c++/reflection: tweak reflection_function_template_p X-Git-Tag: basepoints/gcc-17~67 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=055a2eca6fe2efed84b7287536cd144f789de66b;p=thirdparty%2Fgcc.git c++/reflection: tweak reflection_function_template_p ...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 --- diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index abefbc3358f..ff8fcca72fe 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -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. */ diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index 59f8354a3cf..97b6e76c652 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -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 (t))) + || reflection_function_template_p (t) || variable_template_p (const_cast (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 (x))))); } #include "gt-cp-reflect.h"