[libc++] __tree move and move-assign cannot be used in constant evaluation when the key type has a const-qualified subobject
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Move-construction and move-assignment in `__tree` can't run in constant evaluation since the `value_type` contains a `const` subobject (i.e. `value_type` is `pair`). Inside `__tree`, we try to assign over the `const` member, which is technically UB and not allowed during constexpr.
A few tests in the associative containers are currently disabled because of that. This issue is an anchor for these FIXMEs.
The fix would involve rewriting the value-replacement step in `__tree`'s move paths to be constexpr-friendly (maybe destroy + construct_at when constant evaluated?).
Originating PRs:
- #134330
- #161901
Contributor guide
Research direction
Start in libc++'s __tree move-construction and move-assignment paths, then inspect the disabled constexpr tests and FIXMEs in the associative-container tests. Compare the value-replacement behavior for value_type containing a const-qualified subobject and make those tests pass during constant evaluation without assigning over the const member.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100