Boost. 1.91.0 regression: optional<bool> copy constructor broken
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- cpp
- Domain
- backend-api-design
Research direction
Start in include/boost/optional/detail/union_optional.hpp at the two constructor locations linked in the issue, and reproduce the provided optional example. Compare which constructor is selected for the mutable copy and verify the three assertions after the change; the work is done when the empty optional remains empty.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- C++
- Stars
- 60
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/optional
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
CMake tests fail Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in boostorg/optional
Similar issues
-
bug build
Difficulty 1/5 Under an hour Newbie friendliness 91/100
facebookincubator/velox#19194 ·
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW Openfuzz
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ClickHouse/ClickHouse#122114 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
module/agent platform/macos type/bug/regression
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement PyCDE
Difficulty 2/5 1-3 hours Newbie friendliness 78/100