GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
c++/reflection

c++/reflection: Fix ICE with namespace splice scopes in namespace aliases.

Fixes an Internal Compiler Error (ICE) when using C++ reflection with namespace splice scopes inside namespace aliases.

This commit resolves an Internal Compiler Error (ICE) occurring in C++ reflection when using namespace splice scopes within a namespace alias. The compiler previously crashed because it expected a type but received a namespace declaration due to an incorrect handling of SPLICE_EXPR. The fix involves constructing a SPLICE_SCOPE type when processing dependent namespaces, ensuring correct type handling.

In Details

Fixes an ICE in make_typename_type or make_unbound_class_template when processing a C++20 reflection namespace alias (e.g., namespace A = [:ns:];) where [:ns:] resolves to a dependent namespace. The parser incorrectly produced a NAMESPACE_DECL with ORIGINAL_NAMESPACE as SPLICE_EXPR instead of the expected SPLICE_SCOPE type. The change modifies cp_parser_lookup_name to call make_splice_scope for dependent_namespace_p.

For Context
ICE
Internal Compiler Error. An unexpected condition encountered by the compiler during translation that prevents it from continuing compilation.
C++ reflection
A proposed C++ feature (as of C++20) that allows code to inspect and manipulate types and entities at compile time, often using compile-time programming constructs.
namespace splice scope
A mechanism in C++ that allows a nested namespace to be injected into another namespace's scope, often used in metaprogramming and reflection contexts.
namespace alias
An alternative name given to an existing namespace, declared using the namespace AliasName = ExistingNamespace; syntax.
SPLICE_EXPR
An internal GCC expression code representing a splice operation, likely related to combining or injecting scopes or declarations.
SPLICE_SCOPE
An internal GCC type code representing a scope that is spliced or injected, used in contexts like C++ reflection.
Filed Under: c++compilerreflectionbugfix