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

C++ Reflection Avoids ICE When Substituting Base Class Information

The compiler now avoids internal compiler errors (ICE) when substituting base class information during C++ reflection.

The C++ reflection implementation previously triggered an internal compiler error when attempting to substitute base class information. This commit prevents the substitution of base class information, resolving the ICE. A new test case is added to verify the fix.

In Details

The compiler shouldn't attempt to substitute base class information (binfo) during template substitution (tsubst). This commit adds a check in tsubst_expr to prevent this for REFLECT_BASE expressions, which avoids the ICE.

For Context

C++ reflection is a feature under development that allows programs to inspect and manipulate their own structure at runtime. Template substitution is a process where the compiler replaces generic type parameters in a template with concrete types. This commit fixes a bug in the C++ reflection implementation that caused the compiler to crash when trying to determine the base classes of a reflected type during template substitution. The fix ensures that the compiler handles base class information correctly, avoiding internal errors.

Filed Under: c++reflectionice