Skip to content

sum_value() / sum_error() are not declared noexcept #276

Description

@Bronek

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrelease-0.1Planned for release 0.1

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions