https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123825
--- Comment #3 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:d6386e0984556173339c06b2b7cfe2dd55eeb07b commit r16-7212-gd6386e0984556173339c06b2b7cfe2dd55eeb07b Author: Jakub Jelinek <[email protected]> Date: Sat Jan 31 10:19:26 2026 +0100 c++: Handle argument merging push_local_extern_decl_alias [PR123825] The first testcase comes directly from https://eel.is/c++draft/meta.reflection#names-1.8.2 and shows that we don't handle for -freflection the function argument name difference handling isn't performed for local externs, which doesn't go the duplicate_decls route but directly remembers the alias. The following patch handles outlines the DECL_ARGUMENTS handling from duplicate_decls and uses it in push_local_extern_decl_alias (with some minor differences and for now not propagating attributes back for the push_local_extern_decl_alias case unless -freflection). ALso, I found that the addition of a new alias created completely broken DECL_ARGUMENTS (copied at most the first PARM_DECL, never more than that). That is because copy_decl clears DECL_CHAIN, so the loop always stopped after the first iteration. 2026-01-31 Jakub Jelinek <[email protected]> PR c++/123825 * cp-tree.h (merge_decl_arguments): Declare. * decl.cc (duplicate_decls): Outline DECL_ARGUMENTS handling into ... (merge_decl_arguments): ... new function. * name-lookup.cc (push_local_extern_decl_alias): Call merge_decl_arguments. Don't copy just the first PARM_DECL when creating a new alias FUNCTION_DECL. * g++.dg/reflect/has_identifier3.C: New test. * g++.dg/reflect/identifier_of3.C: New test. * g++.dg/cpp26/attr-indeterminate5.C: New test.
