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