Landing: c1977d101524

Project / Subsystem

gcc / c++/reflection

Date

2026-04-24

Author

Marek Polacek

Commit

c1977d101524d87642790422134fe170ce00b545

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
c++/reflection
patch_id
commit_hash
c1977d101524d87642790422134fe170ce00b545
source_type
github
headline
Disallow reflection on block-scope extern declarations in C++.
tldr
The C++ reflection feature now forbids reflecting on block-scope extern declarations, aligning with the CWG 3065 resolution and fixing a crash.
author
Marek Polacek
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • c++
  • reflection
  • standard
discussion_id_link
bugzilla_pr
date
2026-04-24T00:00:00.000Z

This patch enforces a restriction on C++ reflection, disallowing reflection on block-scope extern declarations, as suggested by CWG issue 3065. This change not only aligns the compiler with the C++ standard but also fixes a crash that could occur when attempting such reflections. The patch adds error handling to prevent reflection of block-scope externs.