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) |
.
Consider the following code:
The reason is that the wrong constructor is taken for
boost::optional(boost::optional&):optional/include/boost/optional/detail/union_optional.hpp
Line 391 in 88e2378
instead of
optional/include/boost/optional/detail/union_optional.hpp
Line 293 in 88e2378