Throughout include/fn/sum.hpp and include/fn/pack.hpp, members are declared unconditionally noexcept while performing operations on user types that may throw. Any such throw becomes std::terminate, and since the spec also reports noexcept == true, callers cannot even detect the hazard by querying noexcept(…).
Sites in sum.hpp:
- widening ctors :258 / :277 / :296 — copy/move-construct the active alternative from
sum<Tx…> (this trio is also currently untested);
- copy ctor :314 and move ctor :330 — construct the active alternative;
requires only is_copy/move_constructible, no nothrow conjunct;
_invoke :183/:188, _transform :193/:201, and the public invoke ×4 (:400-:454), invoke_r ×4 (:473-:527), transform ×4 (:544-:598) — invoke a user callable (and construct the result);
operator== :644 / operator!= :667 — call the user's comparison.
Sites in pack.hpp:
append ×8 (:48-:154) — construct the appended element and copy/move the existing elements into the new pack;
invoke ×4 (:165-:213) / invoke_r ×4 (:230-:281) — user callable.
(has_value, get_ptr, get<I> and the destructors are safe as declared.)
Fix direction: conditional noexcept keyed on the applicable traits — is_nothrow_copy/move_constructible folded over the alternatives for the ctors and append; for the dispatch members, nothrow-invocability over the dispatched set, which needs the #45 traits (currently stubbed to false in fn/detail/functional.hpp:177-186).
Related: #279 is the same defect in operator& at the optional/expected layer; #254 (fn-native noexcept for the sum/pack monadic extensions) has this issue as a prerequisite — precise specs there must derive from these members' true specs.
Tests: the #85 audit found zero noexcept assertions in tests/fn/sum.cpp / tests/fn/pack.cpp; tripwires pinning current behaviour (flipping when fixed) will land with that branch's sum/pack pass (bronek/unit_tests_cleanup).
Throughout
include/fn/sum.hppandinclude/fn/pack.hpp, members are declared unconditionallynoexceptwhile performing operations on user types that may throw. Any such throw becomesstd::terminate, and since the spec also reportsnoexcept == true, callers cannot even detect the hazard by queryingnoexcept(…).Sites in
sum.hpp:sum<Tx…>(this trio is also currently untested);requiresonlyis_copy/move_constructible, no nothrow conjunct;_invoke:183/:188,_transform:193/:201, and the publicinvoke×4 (:400-:454),invoke_r×4 (:473-:527),transform×4 (:544-:598) — invoke a user callable (and construct the result);operator==:644 /operator!=:667 — call the user's comparison.Sites in
pack.hpp:append×8 (:48-:154) — construct the appended element and copy/move the existing elements into the new pack;invoke×4 (:165-:213) /invoke_r×4 (:230-:281) — user callable.(
has_value,get_ptr,get<I>and the destructors are safe as declared.)Fix direction: conditional
noexceptkeyed on the applicable traits —is_nothrow_copy/move_constructiblefolded over the alternatives for the ctors andappend; for the dispatch members, nothrow-invocability over the dispatched set, which needs the #45 traits (currently stubbed tofalseinfn/detail/functional.hpp:177-186).Related: #279 is the same defect in
operator&at the optional/expected layer; #254 (fn-nativenoexceptfor the sum/pack monadic extensions) has this issue as a prerequisite — precise specs there must derive from these members' true specs.Tests: the #85 audit found zero noexcept assertions in
tests/fn/sum.cpp/tests/fn/pack.cpp; tripwires pinning current behaviour (flipping when fixed) will land with that branch's sum/pack pass (bronek/unit_tests_cleanup).