Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for #9822/#9823 #5742

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/testunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6574,6 +6574,25 @@ class TestUnusedVar : public TestFixture {
" return 0;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) Unused variable: a\n", errout.str());

functionVariableUsage("void f() {\n" // #9823
" auto cb = []() {\n"
" int i;\n"
" };\n"
" (void)cb;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (style) Unused variable: i\n", errout.str());

functionVariableUsage("void f() {\n" // #9822
" int i;\n"
" auto cb = []() {\n"
" int i;\n"
" };\n"
" (void)cb;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) Unused variable: i\n"
"[test.cpp:4]: (style) Unused variable: i\n",
errout.str());
}


Expand Down
Loading