Skip to content

Boost. 1.91.0 regression: optional<bool> copy constructor broken #146

Open

Description

@MarcelRaad

Consider the following code:

const boost::optional<bool> constValue;
assert(!constValue.has_value()); // succeeds
boost::optional<bool> mutableValue(constValue);
assert(!mutableValue.has_value()); // succeeds
boost::optional<bool> mutableCopy(mutableValue);
assert(!mutableCopy.has_value()); // fails

The reason is that the wrong constructor is taken for boost::optional(boost::optional&):


instead of
constexpr optional(const optional& rhs)
.

Activity

  1. changed the title [-]Boost. 1.91.0 regression: copy constructor broken[/-] [+]Boost. 1.91.0 regression: optional<bool> copy constructor broken[/+] on Apr 23, 2026
  2. added theissue type on Apr 26, 2026
  3. akrzemi1 commented on Apr 26, 2026

    @akrzemi1
    Member

    Thank you for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions