Issue |
125810
|
Summary |
[Clang] `-Wunused-variable` false negative when not all structured bindings are marked `maybe_unused`
|
Labels |
|
Assignees |
|
Reporter |
zwuis
|
Clang doesn't emit warning when all structured bindings are unused but not all structured bindings are marked `maybe_unused`.
```cpp
struct S {
int a, b;
};
void test(S s) {
auto &[a1, _] = s; // "unused variable" warning emitted expectedly
auto &[a2, b2 [[maybe_unused]]] = s; // no warning emitted unexpectedly
auto &[_, b3 [[maybe_unused]]] = s; // no warning emitted expectedly
}
```
Compiler Explorer: <https://godbolt.org/z/vnf9Ma3nb>
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs