This commit is contained in:
chrchr-github 2021-12-21 10:24:38 +01:00 committed by GitHub
parent ca4e5ac527
commit 5a95ece15e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -1591,6 +1591,14 @@ private:
" g(t);\n" " g(t);\n"
"};\n"); "};\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkStructMemberUsage("struct T { int i; };\n"
"void f() {\n"
" struct T t{};\n"
" t.i = 0;\n" // <- used
" g(t);\n"
"};\n");
TODO_ASSERT_EQUALS("", "[test.cpp:1]: (style) struct member 'T::i' is never used.\n", errout.str()); // due to removeMacroInClassDef()
} }
void functionVariableUsage_(const char* file, int line, const char code[], const char filename[] = "test.cpp") { void functionVariableUsage_(const char* file, int line, const char code[], const char filename[] = "test.cpp") {