parent
350a1f2dfc
commit
b4c90f8b2a
|
@ -1620,7 +1620,7 @@ void CheckUninitVar::valueFlowUninit()
|
|||
continue;
|
||||
uninitderef = deref && v->indirect == 0;
|
||||
const bool isleaf = isLeafDot(tok) || uninitderef;
|
||||
if (Token::Match(tok->astParent(), ". %var%") && !isleaf)
|
||||
if (!isleaf && Token::Match(tok->astParent(), ". %name%") && (tok->astParent()->next()->varId() || tok->astParent()->next()->isEnumerator()))
|
||||
continue;
|
||||
}
|
||||
const ExprUsage usage = getExprUsage(tok, v->indirect, mSettings);
|
||||
|
|
|
@ -6272,6 +6272,16 @@ private:
|
|||
" h.e();\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #11597
|
||||
valueFlowUninit("void f(size_t f) {\n"
|
||||
" struct {\n"
|
||||
" int i;\n"
|
||||
" enum { offset = 1062 };\n"
|
||||
" } s;\n"
|
||||
" if (f < s.offset + sizeof(s)) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitvar_memberfunction() {
|
||||
|
|
Loading…
Reference in New Issue