1- # Handoff: After Fix 4
1+ # Handoff: After Fix 5 (All Conformance Fixes Complete)
22
33## What Was Done
44
5- Fix 4 is complete. ` static_assert ` Mandates added to observers and monadic
6- operations per standard wording. Branch ` fix4-mandates ` merged (--no-ff) into
7- ` expected-over-references ` .
5+ Fix 5 is complete. Branch ` fix5-preconditions-and-minor ` merged (--no-ff) into
6+ ` expected-over-references ` . All conformance fixes (F1–F5) are now merged.
87
9- ### Changes in ` include/beman/expected/expected.hpp `
8+ ### Changes in Fix 5
109
11- ** Primary template class-level:**
12- - ` static_assert(!detail::is_unexpected_specialization<remove_cv_t<T>>::value, ...) `
10+ ** ` include/beman/expected/expected.hpp ` :**
11+ - Added ` BEMAN_EXPECTED_HARDENED ` precondition guards (` __builtin_trap() ` ) to:
12+ - ` operator->() ` (both const and non-const) — checks ` has_val_ `
13+ - ` operator*() ` (all 4 overloads) — checks ` has_val_ `
14+ - ` error() ` (all 4 overloads, primary template) — checks ` !has_val_ `
15+ - ` operator*() ` (void specialization) — checks ` has_val_ `
16+ - ` error() ` (all 4 overloads, void specialization) — checks ` !has_val_ `
17+ - Void ` or_else ` (4 overloads): changed ` is_void_v<G::value_type> ` to
18+ ` is_same_v<G::value_type, T> ` — correct for ` const void ` etc.
19+ - Void ` transform_error ` (4 overloads): changed ` expected<void, G> ` to
20+ ` expected<T, G> ` — matches standard wording
1321
14- ** Primary template ` value() ` (4 overloads):**
15- - ` const& ` / ` & ` : ` is_copy_constructible_v<E> `
16- - ` && ` / ` const&& ` : ` is_copy_constructible_v<E> && is_constructible_v<E, decltype(std::move(error()))> `
22+ ** ` include/beman/expected/unexpected.hpp ` :**
23+ - Added ` requires std::is_swappable_v<E> ` to friend swap
1724
18- ** Primary template ` value_or() ` (2 overloads):**
19- - ` const& ` : ` is_copy_constructible_v<T> ` , ` is_convertible_v<U, T> `
20- - ` && ` : ` is_move_constructible_v<T> ` , ` is_convertible_v<U, T> `
21-
22- ** ` error_or() ` (4 overloads — both primary and void):**
23- - ` const& ` : ` is_copy_constructible_v<E> ` , ` is_convertible_v<G, E> `
24- - ` && ` : ` is_move_constructible_v<E> ` , ` is_convertible_v<G, E> `
25-
26- ** Void specialization ` value() ` (2 overloads):**
27- - ` const& ` : ` is_copy_constructible_v<E> `
28- - ` && ` : ` is_copy_constructible_v<E> && is_move_constructible_v<E> `
29-
30- ** ` transform() ` (8 overloads — both primary and void):**
31- - In ` if constexpr (!is_void_v<U>) ` block: U not array, not in_place_t, not unexpect_t, not unexpected<>
32-
33- ** ` transform_error() ` (8 overloads — both primary and void):**
34- - G is object, not array, not cv-qualified, not unexpected<>
35-
36- ### Tests added
37-
38- - ` tests/beman/expected/expected_unexpected_value_type_fail.cpp ` — negative compile
39- test verifying ` expected<unexpected<int>, int> ` is ill-formed
25+ ** Tests added:**
26+ - ` tests/beman/expected/expected_hardened.test.cpp ` — compiled with
27+ ` -DBEMAN_EXPECTED_HARDENED ` , verifies happy paths and swap constraint
28+ - New CMake target ` beman.expected.tests.hardened `
4029
4130### Test count
4231
43- 248 tests total, all passing.
32+ 253 tests total, all passing.
4433
4534## Build Commands
4635
4736``` bash
48- make TOOLCHAIN=gcc-16 test # 248 tests, all passing
37+ make TOOLCHAIN=gcc-16 test # 253 tests, all passing
4938make lint # all linters pass (beman-tidy crash is pre-existing)
5039```
5140
@@ -54,13 +43,21 @@ make lint # all linters pass (beman-tidy crash is pre-existin
5443- [x] Fix 1: Constructor/assignment/equality constraints
5544- [x] Fix 2: Trivial special member functions
5645- [x] Fix 3: Monadic operation constraints
57- - [x] Fix 4: Mandates static_asserts ← just done
58- - [ ] Fix 5: Hardened preconditions and minor fixes
46+ - [x] Fix 4: Mandates static_asserts
47+ - [x] Fix 5: Hardened preconditions and minor fixes ← just done
48+
49+ ## All Conformance Fixes Complete
50+
51+ The conformance fixes phase is finished. Per ` docs/conformance-fixes/index.md ` ,
52+ the next actions are:
5953
60- ## Next Step: Fix 5
54+ 1 . Update ` docs/conformance-audit.md ` to mark resolved items
55+ 2 . Update this handoff for the post-fix state
56+ 3 . Proceed to Step 7: ` docs/plan/step7-expected-ref-t.md `
6157
62- Fix 5 adds hardened precondition checks to observers (` operator-> ` , ` operator* ` ,
63- ` error() ` ) and miscellaneous minor fixes (friend swap constraint on
64- ` unexpected<E> ` , etc.).
58+ ## State of the Implementation
6559
66- See ` docs/conformance-fixes/fix5-preconditions-and-minor.md ` .
60+ The ` expected-over-references ` branch now has a fully conformant ` expected<T,E> `
61+ and ` expected<void,E> ` (modulo the extensions noted in the audit as conforming).
62+ All constraint, Mandates, trivial SMF, monadic SFINAE, and precondition gaps
63+ identified in the audit are resolved.
0 commit comments