Skip to content

aggregates: key the structured backend on P1061, not the 202403L level - #190

Merged
jcelerier merged 1 commit into
mainfrom
fix/aggregate-backend-p1061-level
Aug 17, 2026
Merged

aggregates: key the structured backend on P1061, not the 202403L level#190
jcelerier merged 1 commit into
mainfrom
fix/aggregate-backend-p1061-level

Conversation

@jcelerier

Copy link
Copy Markdown
Member

The aggregate backend guard admits a compiler that cannot compile the backend it selects.

g++-15 reports __cpp_structured_bindings=202403L — that is P0609 (attributes on structured bindings), not P1061 (packs). The guard accepts >= 202403L, so g++-15 passes it, selects the structured backend, and then fails:

aggregates.structured.hpp:82:11: error: expected identifier before ‘...’ token
   82 |       auto&& [... members] = item;

P1061 — the paper the structured backend actually depends on — is 202411L, which only g++-16 reports. The guard's own comments already say gcc < 16 / gcc >= 16, so this is just the constant not matching the stated intent.

Effect

Verified by preprocessing AVND_USE_BOOST_PFR against each compiler:

compiler before after
g++-14 gnu++23 / gnu++26 pfr pfr
g++-15 gnu++23 pfr pfr
g++-15 gnu++26 structured (fails to compile) pfr
g++-16 gnu++23 pfr pfr
g++-16 gnu++26 structured structured
clang 23 gnu++23 / gnu++26 structured structured

Only the broken cell changes; clang and g++-16 are unaffected.

Why it matters beyond the hard error

On the pfr fallback, instantiating a large aggregate is very expensive. Compiling a ~336-field object (Kaboom, via score-addon-synthimi) with g++-14 peaks at 40.9 GB RSS and is OOM-killed; -fsyntax-only alone reaches 10 GB, so it is front-end instantiation, not codegen — no optimisation flag affects it. The same TU on g++-16 gnu++26, i.e. on the structured backend, compiles in 151 s at 7.1 GB. So which side of this guard a compiler lands on is the difference between building and exhausting memory, and g++-15 currently lands on a third option: neither.

g++-15 reports __cpp_structured_bindings=202403L for P0609 (attributes on
structured bindings) but does not implement P1061 packs. It therefore passed
the guard, selected the structured backend, and failed to compile
aggregates.structured.hpp at `auto&& [... members]`.

P1061 is 202411L, which is what the backend actually needs. Keying on it sends
g++-15 back to the boost.pfr fallback and leaves g++-16 and clang >= 21 on the
structured path, unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ux7eanJYt46tkpQhitnk2r
@jcelerier
jcelerier merged commit 569abb9 into main Aug 17, 2026
4 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant