https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124926
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:100164d1aa600aba59d780841661b20e359ebb0c commit r16-8852-g100164d1aa600aba59d780841661b20e359ebb0c Author: Marek Polacek <[email protected]> Date: Wed Apr 22 11:36:37 2026 -0400 c++/reflection: reflect on dependent class template [PR124926] Here we issue a bogus error for ^^Cls<T>::template Inner where Inner turns out to be a class type, but we created a SCOPE_REF because we can't know in advance what it will substitute into, and ^^typename Cls<T>::template Inner is invalid. The typename can only be used in ^^typename Cls<T>::template Inner<int> We're taking a reflection so both types and non-types are valid, so I think we shouldn't give the error for ^^, and take the reflection of the TEMPLATE_DECL. PR c++/124926 gcc/cp/ChangeLog: * pt.cc (tsubst_qualified_id): Rename name_lookup_p parameter to reflecting_p. Check !reflecting_p instead of name_lookup_p. Do not give the "instantiation yields a type" error when reflecting_p is true. (tsubst_expr) <case REFLECT_EXPR>: Adjust the call to tsubst_qualified_id. gcc/testsuite/ChangeLog: * g++.dg/reflect/dep15.C: New test. Reviewed-by: Patrick Palka <[email protected]> (cherry picked from commit f78cb5ae260a88d9499d1496f3ba6fd54dd04bac)
