https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123612
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:e60f6111f63e8164158cd5ed2957e77532a63441 commit r16-7537-ge60f6111f63e8164158cd5ed2957e77532a63441 Author: Jakub Jelinek <[email protected]> Date: Tue Feb 17 08:37:34 2026 +0100 c++: For reflection look through DECL_LOCAL_DECL_P decls and fix up has_default_argument [PR123612] Based on discussions in the PR that C++ 26 reflection is entity based rather than declaration based, the following patch ensures we reflect DECL_LOCAL_DECL_ALIAS of DECL_LOCAL_DECL_P vars or function decls. Additionally, while default arguments are intentionally not merged from the block scope externs to their corresponding namespace scope function decls, for std::meta::has_default_argument the wording requires to return true even if there is at least one block scope extern with default argument for the particular parameter. So, the patch also records in a new flag whether a default argument has been present in a block scope extern and propagates it through further duplicate_decls. eval_has_default_arguments then uses both this new flag (for the block scope externs) and the preexisting search for default arguments in the corresponding type. 2026-02-17 Jakub Jelinek <[email protected]> PR c++/123612 * cp-tree.h (DECL_HAS_DEFAULT_ARGUMENT_P): Define. * decl.cc (merge_decl_arguments): For -freflection and extern_alias set DECL_HAS_DEFAULT_ARGUMENT_P (oldarg) if newdecl has a default argument for that parameter, otherwise propagate the flag. * reflect.cc (get_reflection): For DECL_LOCAL_DECL_P use its DECL_LOCAL_DECL_ALIAS. (eval_has_default_argument): Return boolean_true_node also if DECL_HAS_DEFAULT_ARGUMENT_P flag is set. * g++.dg/reflect/pr123612.C: New test.
