[LifetimeSafety] False-positive due to assignments involving std::tie
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
https://godbolt.org/z/q6ToGh779
```cpp
#include
#include
int& reproduce(int Key) {
std::map Cache;
std::map::iterator It = Cache.begin();
bool New;
std::tie(It, New) = Cache.try_emplace(Key);
return It->second;
}
```
`std::tie` on LHS should KILL the iterator `It` value and therefore it shouldn't be considered alive at the point of invalidation.
Contributor guide
Research direction
Start with the Godbolt reproducer in the issue and inspect the LifetimeSafety analysis handling of assignments to std::tie. Confirm how the left-hand-side assignment affects the iterator's lifetime state, then add regression coverage showing that this example no longer produces a false positive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100