Landing: 6481ee18e339

Project / Subsystem

gcc / c++

Date

2026-05-07

Author

Jakub Jelinek

Commit

6481ee18e339356e3f5ff65428224ee4c500bc41

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
6481ee18e339356e3f5ff65428224ee4c500bc41
source_type
github
headline
C++ Reflection Fixes Sharing of Type Information for Anonymous Unions
tldr
GCC now handles reflection on anonymous unions/structs correctly by differentiating between `CLASSTYPE_TYPEINFO_VAR` and `ANON_AGGR_TYPE_FIELD`. This prevents…
author
Jakub Jelinek
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • reflection
  • anonymous union
  • bugfix
  • typeid
discussion_id_link
bugzilla_pr
date
2026-05-07T00:00:00.000Z

GCC now correctly handles reflection on anonymous unions and structs within classes by distinguishing between CLASSTYPE_TYPEINFO_VAR (for typeid) and ANON_AGGR_TYPE_FIELD (for anonymous union/struct members). Previously, the compiler shared the same tree node for both, which led to internal compiler errors when reflection was used on anonymous unions. The fix uses a TREE_LIST to store both when necessary, avoiding an increase in the size of the lang_type struct.