Skip to content

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

@MarcelRaad

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)
.

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