Landing: cce6cc2a791b
Project / Subsystem
gcc / c++
Date
2026-05-15
Author
Marek Polacek
Commit
cce6cc2a791b5617716568a7ae33ef5f71e313cd
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- c++
- patch_id
- —
- commit_hash
- cce6cc2a791b5617716568a7ae33ef5f71e313cd
- source_type
- github
- headline
- Fixes constexpr crash with nested empty objects.
- tldr
- This commit prevents a crash in constexpr evaluation when dealing with nested empty objects by avoiding premature calls to `get_or_insert_ctor_field`.
- author
- Marek Polacek
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • c++
- • constexpr
- • bugfix
- • no_unique_address
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-15T00:00:00.000Z
This commit addresses a crash that occurred during constexpr evaluation when an empty object contained a subobject that also required initialization. The issue stemmed from incorrect handling of constructor contexts during the evaluation of bare aggregates. Specifically, the cxx_eval_bare_aggregate function was calling get_or_insert_ctor_field with a null constructor context in certain scenarios, leading to a crash. The fix avoids this premature call, preventing the crash. New test cases g++.dg/cpp2a/no_unique_address17.C and g++.dg/cpp2a/no_unique_address18.C have been added.