Skip to content

Commit

Permalink
add test for range based for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne committed Jan 9, 2025
1 parent 97ebed3 commit c727c82
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/testunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2042,6 +2042,14 @@ class TestUnusedVar : public TestFixture {
" x = y;\n"
"}\n");
ASSERT_EQUALS("", errout_str());

checkStructMemberUsage("struct S { int a, b; };\n"
"void f() {\n"
" std::vector<S> s = { { 1, 2 } };\n"
" for (auto& [x, y] : s)\n"
" x = y;\n"
" }\n");
ASSERT_EQUALS("", errout_str());
}

void functionVariableUsage_(const char* file, int line, const char code[], bool cpp = true) {
Expand Down

0 comments on commit c727c82

Please sign in to comment.