You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testunusedvar.cpp
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -259,6 +259,8 @@ class TestUnusedVar : public TestFixture {
259
259
TEST_CASE(escapeAlias); // #9150
260
260
TEST_CASE(volatileData); // #9280
261
261
TEST_CASE(globalData);
262
+
263
+
TEST_CASE(structuredBinding); // #13269
262
264
}
263
265
264
266
structFunctionVariableUsageOptions
@@ -7197,6 +7199,16 @@ class TestUnusedVar : public TestFixture {
7197
7199
"}");
7198
7200
ASSERT_EQUALS("", errout_str());
7199
7201
}
7202
+
7203
+
voidstructuredBinding() { // #13269
7204
+
functionVariableUsage("int main()\n"
7205
+
"{\n"
7206
+
" auto [a0, b1] = std::make_pair(42, 0.42);\n"
7207
+
" [[maybe_unused]] auto [a2, b3] = std::make_pair(42, 0.42);\n"
7208
+
"}\n");
7209
+
7210
+
ASSERT_EQUALS("[test.cpp:3:19]: (style) Variable 'a0' is assigned a value that is never used. [unreadVariable]\n[test.cpp:3:19]: (style) Variable 'b1' is assigned a value that is never used. [unreadVariable]\n", errout_str());
0 commit comments