Landing: ad1f516c3196

Project / Subsystem

gcc / c++

Date

2026-07-23

Author

Jakub Jelinek

Commit

ad1f516c31965657aa16c6b601db111f57276d45

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++
patch_id
commit_hash
ad1f516c31965657aa16c6b601db111f57276d45
source_type
github
headline
C++: Diagnose objects with anonymous union/struct types per CWG3130
tldr
GCC now diagnoses uses of anonymous unions and structs that violate CWG3130's intent, preventing certain declarations and derived types.
author
Jakub Jelinek
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • language
  • diagnostics
discussion_id_link
bugzilla_pr
date
2026-07-23T00:00:00.000Z

Following C++ standard clarification CWG3130, GCC now diagnoses declarations of objects with anonymous union or struct types. This prevents issues like ICEs and unexpected behavior that could arise from reusing anonymous types. The compiler will now error on variable declarations, function parameters, class members, and array types involving anonymous unions or structs. It also disallows anonymous structs from being used as base classes.