`performance-noexcept-move-constructor` does not fire in some cases
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
The performance-noexcept-move-constructor warning does not fire for the move constructor when that constructor is explicitly invoked in the code:
https://godbolt.org/z/37GhMErGh
Additionally, the warning does not fire for the move assignment operator (operator=) when, together with a variable whose move constructor and move assignment operator are not noexcept, std::vector<...> is used (https://godbolt.org/z/sfxPehdh4).
Notably, std::vector must be declared above the problematic variable.
Example where the warning does NOT trigger:
```
std::vector cache_;
Value value; // warning does NOT appear
```
Example where the warning DOES trigger (as expected):
```
Value value; // warning appears
std::vector cache_;
```
https://godbolt.org/z/fqrhf4v6q
https://godbolt.org/z/f6b8h6e81
Contributor guide
Research direction
Start by reproducing the explicit move-constructor and move-assignment cases in the linked Compiler Explorer examples, then trace the performance-noexcept-move-constructor check in the LLVM project. Done means the check warns in both cases, including when std::vector is declared before the problematic variable, without changing the expected warning behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100