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&)`: https://github.com/boostorg/optional/blob/88e2378c8a9a45d4617d9386619677038b392ff1/include/boost/optional/detail/union_optional.hpp#L391 instead of https://github.com/boostorg/optional/blob/88e2378c8a9a45d4617d9386619677038b392ff1/include/boost/optional/detail/union_optional.hpp#L293.
Activity
[-]Boost. 1.91.0 regression: copy constructor broken[/-][+]Boost. 1.91.0 regression: optional<bool> copy constructor broken[/+]akrzemi1 commentedon Apr 26, 2026
Thank you for reporting this.
dev-libs/boost: fix regression with optional<bool> copy ctor