Landing: 87cf7de666ef
Project / Subsystem
gcc / libstdc++
Date
2026-07-02
Author
Tomasz Kamiński
Commit
87cf7de666efe5b7da0b32cc796f7289caf8f96c
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- libstdc++
- patch_id
- —
- commit_hash
- 87cf7de666efe5b7da0b32cc796f7289caf8f96c
- source_type
- github
- headline
- libstdc++: Return optional<const _Ex&> from exception_ptr_cast
- tldr
- Updates exception_ptr_cast to return optional<const _Ex&>, implementing P3981R2 and improving exception handling.
- author
- Tomasz Kamiński
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • libstdc++
- • exception handling
- • optional
- • cpp26
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-02T00:00:00.000Z
This commit implements the latter half of the P3981R2 proposal by changing the return type of std::exception_ptr_cast from a reference to optional<const _Ex&>. This change requires including the <optional> header for several related functions, such as value, transform, and and_then, to avoid cyclic includes and instantiation issues. A new public helper function, _S_from_ptr, is also introduced for optional<T&> to simplify construction from pointers.