Re: [RFC] Proposal for tagged_by attribute to describe union discriminators
Project / Subsystem
gcc / gcc
Date
2026-07-18
Proposer
Eric Botcazou <botcazou@adacore.com>
Source type
public_inbox
Consensus
Proposed
Sentiment
—/10
Technical tradeoffs
- • Enables better code generation and debugging for discriminated unions at the cost of increased compiler complexity.
All attributes
- project
- gcc
- subsystem
- gcc
- patch_id
- —
- discussion_id
- 2417780.ElGaqSPkdT@fomalhaut
- source_type
- public_inbox
- title
- Re: [RFC] Proposal for tagged_by attribute to describe union discriminators
- headline
- Proposal for tagged_by attribute to describe union discriminators
- tldr
- Introduce tagged_by attribute for discriminated unions, impacting layout and debug info.
- proposer
- Eric Botcazou <botcazou@adacore.com>
- consensus
- Proposed
- outcome
- proposed
- sentiment_score
- —
- technical_tradeoffs
-
- • Enables better code generation and debugging for discriminated unions at the cost of increased compiler complexity.
- series_id
- —
- series_role
- standalone
- series_parts
- []
- tags
-
- • gcc
- • attribute
- • union
- • type system
- • debug info
- bugzilla_url
- —
- date
- 2026-07-18T00:00:00.000Z
Re: [RFC] Proposal for tagged_by attribute to describe union discriminators
Eric Botcazou proposes the ‘tagged_by’ attribute to describe union discriminators in GCC. This attribute is used for driving layout and debug info generation, and it differs from UNION_TYPE by enabling runtime checks and having a dynamic size based on the active member. The predicate for this attribute references the tag via PLACEHOLDER_EXPRs.