| Issue |
244404
|
| Summary |
[clang-tidy] performance-unnecessary-copy-initialization does not honor `[[maybe_unused]]` attribute
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
e-kwsm
|
clang-tidy 23.1.5
```cpp
#include <vector>
int main() {
std::vector<double> v;
[[maybe_unused]] auto w{v};
}
```
While `w` is declared as maybe unused, performance-unnecessary-copy-initialization suggests to remove it:
> warning: local copy 'w' of the variable 'v' of type 'std::vector<double>' is never modified and *never used*; consider removing the statement [performance-unnecessary-copy-initialization]
(emphasis mine)
I think it would be better to suggest const reference instead, or suppress the diagnostics.
<https://godbolt.org/z/j7aqhWsMK>
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs