Neither fn::optional::sum_value() nor fn::expected::sum_value() declares noexcept on any overload.
- The
decltype(auto) self-return overloads (include/fn/optional.hpp:495-510, include/fn/expected.hpp:688-703) just return *this by reference and cannot throw — they should be unconditionally noexcept.
- The constructing overloads (
optional.hpp:477/486, expected.hpp:670/679) wrap the value in a fresh optional<sum<…>> / expected<sum<…>,E> — they could be conditionally noexcept (keyed on nothrow construction of the sum from the value).
- The free
sum_value() (optional.hpp:879, expected.hpp:1020) forward, so they'd propagate the member's noexcept.
- Impact: monadic pipelines lose
noexcept unnecessarily.
- Tests: tripwire
static_assert(not noexcept(...)) in tests/fn/optional.cpp pin the current behaviour and will flip when fixed.
Neither
fn::optional::sum_value()norfn::expected::sum_value()declaresnoexcepton any overload.decltype(auto)self-return overloads (include/fn/optional.hpp:495-510,include/fn/expected.hpp:688-703) just return*thisby reference and cannot throw — they should be unconditionallynoexcept.optional.hpp:477/486,expected.hpp:670/679) wrap the value in a freshoptional<sum<…>>/expected<sum<…>,E>— they could be conditionallynoexcept(keyed on nothrow construction of the sum from the value).sum_value()(optional.hpp:879,expected.hpp:1020) forward, so they'd propagate the member's noexcept.noexceptunnecessarily.static_assert(not noexcept(...))intests/fn/optional.cpppin the current behaviour and will flip when fixed.