GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cp/reflection

c++/reflection: Fixed bogus error with dependent using declarations

Fixes a compiler error when using dependent dependent typename declarations in reflection contexts.

The C++ reflection mechanism now correctly handles dependent using typename declarations within templates. Previously, a bogus error occurred when trying to declare a type alias within a template where the namespace was a template parameter. This change ensures that such dependent declarations are properly recognized as types.

In Details

In name-lookup.cc, the finish_nonmember_using_decl function now accepts a typename_p boolean. This flag is propagated from parser.cc's finish_using_decl and pt.cc's tsubst_stmt. When set, it indicates that a USING_DECL should be treated as a type name, even when it refers to a dependent name in a non-class scope. This resolves an issue where the USING_DECL_TYPENAME_P flag was not being correctly propagated.

For Context
reflection
A C++ feature (currently in study for standardization) that allows code to inspect and manipulate its own structure at compile time or runtime. This commit relates to compile-time reflection capabilities.
using declaration
A C++ construct (using namespace X; or using X::Y;) that brings names from a namespace into the current scope or declares an alias for a specific name.
dependent name
In C++ templates, a name whose meaning cannot be determined until the template is instantiated with specific arguments. This often involves names that depend on a template parameter.
typename keyword
In C++, the typename keyword is used to explicitly state that a dependent name should be interpreted as a type name, disambiguating it from potential non-type names.
Filed Under: c++reflectiontemplatebugfix