https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116748
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Nathaniel Shead <nsh...@gcc.gnu.org>: https://gcc.gnu.org/g:b9ac51a843f9dc807b00ab7f49f64968807a4ee8 commit r15-3938-gb9ac51a843f9dc807b00ab7f49f64968807a4ee8 Author: Nathaniel Shead <nathanielosh...@gmail.com> Date: Fri Sep 20 00:05:04 2024 +1000 c++: Don't strip USING_DECLs when updating local bindings [PR116748] Currently update_binding strips USING_DECLs too eagerly, leading to ICEs in pop_local_decl as it can't find the decl it's popping in the binding list. Let's rather try to keep the original USING_DECL around. This also means that using59.C can point to the location of the using-decl rather than the underlying object directly; this is in the direction required to fix PR c++/106851 (though more work is needed to emit properly helpful diagnostics here). PR c++/116748 gcc/cp/ChangeLog: * name-lookup.cc (update_binding): Maintain USING_DECLs in the binding slots. gcc/testsuite/ChangeLog: * g++.dg/lookup/using59.C: Update location. * g++.dg/lookup/using69.C: New test. Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com> Reviewed-by: Jason Merrill <ja...@redhat.com>