https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126654
--- 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:1801e9f042319e934045f3d4aaaa3ba40e22d017 commit r17-4858-g1801e9f042319e934045f3d4aaaa3ba40e22d017 Author: Marek Polacek <[email protected]> Date: Fri Oct 2 16:53:46 2026 -0400 c++/reflection: bogus error with block-scope using [:ns:]::S [PR126654] Here we emit error "'::' is not a class, namespace, or enumeration" for using [:ns:]::S; // where ns=^^:: which is clearly wrong. tsubst_stmt/DECL_EXPR has scope = tsubst (scope, args, complain, in_decl); if (!MAYBE_CLASS_TYPE_P (scope) && TREE_CODE (scope) != ENUMERAL_TYPE) { if (complain & tf_error) error_at (DECL_SOURCE_LOCATION (decl), "%qT is not a " "class, namespace, or enumeration", scope); return error_mark_node; } but it never checked for a NAMESPACE_DECL. That was ok before P2996 which brought dependent namespaces but now we need to allow them. As it so happens, I found another problem in this space, a failure to propagate USING_DECL_TYPENAME_P (127707). PR c++/126654 gcc/cp/ChangeLog: * pt.cc (tsubst_stmt) <case DECL_EXPR>: If tsubst returns error_mark_node, return error_mark_node. Allow NAMESPACE_DECL. gcc/testsuite/ChangeLog: * g++.dg/reflect/ns11.C: New test. Reviewed-by: Jason Merrill <[email protected]>
