-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang-tidy][BUG][C++23][False Positive] on no name placeholder with std::string type #121731
Comments
@llvm/issue-subscribers-clang-tidy Author: None (yaoxinliu)
```
auto _ = "abc"sv;
auto _ = 1234; // ok
auto _ = 3.14; // ok
auto _ = "abcd"sv; // ok
auto _ = {1, 2, 3}; // ok
auto _ = "abcd"s; // warning by clang-tidy: Unused local variable '_' of type 'basic_string<char>'
auto _ = [] { return ""s; }(); // warning by clang-tidy: Unused local variable '_' of type 'basic_string<char>'
```
My clang-tidy version is 19.1.5. |
…s after C++26 for bugprone-unused-local-non-trivial-variable Fixed: llvm#121731 According to https://eel.is/c++draft/basic.scope.scope#5, name independent declaration should not be warned as unused
@HerrCai0907, why does this false positive occur for |
The other types are not non trivial. But i don't look details for the default non trivial type list. |
I tested |
Thanks for your clarification. |
My clang-tidy version is 19.1.5.
Note that this false positive occur for
std::string
only, other types, evenstd::vector<int>
andstd::unique_ptr<int>
which are obviously non-trivial classes, seem also good as expected.The text was updated successfully, but these errors were encountered: