| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++26 -Wunused %s |
| 2 |
|
| 3 |
namespace GH125810 { |
| 4 |
struct S { |
| 5 |
int a, b; |
| 6 |
}; |
| 7 |
|
| 8 |
void t(S s) { |
| 9 |
auto &[_, _] = s; |
| 10 |
auto &[a1, _] = s; // expected-warning {{unused variable '[a1, _]'}} |
| 11 |
auto &[_, b2] = s; // expected-warning {{unused variable '[_, b2]'}} |
| 12 |
|
| 13 |
auto &[a3 [[maybe_unused]], b3 [[maybe_unused]]] = s; |
| 14 |
auto &[a4, b4 [[maybe_unused]]] = s; // expected-warning {{unused variable '[a4, b4]'}} |
| 15 |
auto &[a5 [[maybe_unused]], b5] = s; // expected-warning {{unused variable '[a5, b5]'}} |
| 16 |
} |
| 17 |
} |