https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127707
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:1b961bf9d7e76de9a36f93d8749dbe7fae302246 commit r17-4940-g1b961bf9d7e76de9a36f93d8749dbe7fae302246 Author: Marek Polacek <[email protected]> Date: Tue Oct 6 12:20:13 2026 -0400 c++/reflection: using typename [:ns:]::X; should declare a type [PR127707] This fixes a bogus error for namespace N { struct S {}; } template<auto ns> void f () { using typename [:ns:]::S; S s; } It is a failure to propagate USING_DECL_TYPENAME_P to the USING_DECL in case we are not at_class_scope_p. With that flag set, the dependent USING_DECL will be treated as naming a type. PR c++/127707 gcc/cp/ChangeLog: * name-lookup.cc (finish_nonmember_using_decl): New bool parameter. Set USING_DECL_TYPENAME_P if it's true. * name-lookup.h (finish_nonmember_using_decl): Adjust declaration. * parser.cc (finish_using_decl): Pass typename_p to finish_nonmember_using_decl. * pt.cc (tsubst_stmt) <case DECL_EXPR>: Pass USING_DECL_TYPENAME_P to finish_nonmember_using_decl. gcc/testsuite/ChangeLog: * g++.dg/reflect/ns12.C: New test. Reviewed-by: Jason Merrill <[email protected]>
