[Clang] -Wunused-variable
false negative when not all structured bindings are marked maybe_unused
(original) (raw)
Clang doesn't emit warning when all structured bindings are unused but not all structured bindings are marked maybe_unused
.
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