Skip to content

Commit

Permalink
reduce tests more
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne committed Jan 9, 2025
1 parent 571eef6 commit e2d99f7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/testunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2027,26 +2027,23 @@ class TestUnusedVar : public TestFixture {

void structmemberStructuredBinding() { // #13107
checkStructMemberUsage("struct S { int a, b; };\n"
"void f() {\n"
" S s{};\n"
"void f(S &s) {\n"
" auto& [x, y] = s;\n"
" x = y;\n"
"}\n");
ASSERT_EQUALS("", errout_str());

checkStructMemberUsage("struct S { int a, b; };\n"
"struct T { S s; };\n"
"void f() {\n"
" T t{};\n"
"void f(T &t) {\n"
" auto& [x, y] = t.s;\n"
" 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"
"void f(std::vector<S> &sv) {\n"
" for (auto& [x, y] : sv)\n"
" x = y;\n"
" }\n");
ASSERT_EQUALS("", errout_str());
Expand Down

0 comments on commit e2d99f7

Please sign in to comment.