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 c9a388e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/testunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2027,28 +2027,25 @@ 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");
"}\n");
ASSERT_EQUALS("", errout_str());
}

Expand Down

0 comments on commit c9a388e

Please sign in to comment.