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

c++/reflection: Fix ICE with bases_of.

The compiler no longer crashes when using bases_of on a TREE_BINFO in reflection.

The compiler was crashing in strip_typedefs_expr when recursing on a REFLECT_EXPR with TREE_BINFO as its operand. The fix prevents the recursion for REFLECT_EXPRs entirely, resolving the ICE (Internal Compiler Error).

In Details

The ICE occurred in strip_typedefs_expr within the C++ reflection implementation. The function was recursing on a REFLECT_EXPR with a TREE_BINFO operand, which it isn't designed to handle. The fix avoids the recursion step. The relevant code is in gcc/cp/tree.cc.

For Context

Reflection is a feature that allows a program to inspect and manipulate its own structure at runtime. In C++, this can include examining the members of a class or the arguments of a function. This commit fixes a bug that caused the compiler to crash when using the bases_of feature with reflection, which is used to inspect the base classes of a class.

Filed Under: c++reflectionbugfix