Fix FP for members of temporaries
This commit is contained in:
parent
da15efb3f6
commit
6304a4dddb
|
@ -1265,6 +1265,11 @@ void CheckUnusedVar::checkStructMemberUsage()
|
|||
used = true;
|
||||
break;
|
||||
}
|
||||
const Function* function = structVarTok->function();
|
||||
if (function && function->retType && function->retType->name() == structname) {
|
||||
used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!used) {
|
||||
|
|
|
@ -250,6 +250,21 @@ private:
|
|||
" a->a;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:7]: (style) struct member 'B::a' is never used.\n", errout.str());
|
||||
|
||||
checkStructMemberUsage("struct A\n"
|
||||
"{\n"
|
||||
" int a;\n"
|
||||
"};\n"
|
||||
"struct B\n"
|
||||
"{\n"
|
||||
" int a;\n"
|
||||
"};\n"
|
||||
"A& bar();\n"
|
||||
"void foo()\n"
|
||||
"{\n"
|
||||
" bar().a;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:7]: (style) struct member 'B::a' is never used.\n", errout.str());
|
||||
}
|
||||
|
||||
void structmember2() {
|
||||
|
|
Loading…
Reference in New Issue