Fix 10119: ValueFlow; object member is not uninitialized. happens when there is static member also. (#3299)
This commit is contained in:
parent
a7707a457d
commit
eb7b225fc1
|
@ -907,7 +907,7 @@ void SymbolDatabase::createSymbolDatabaseNeedInitialization()
|
||||||
unknown = true;
|
unknown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!var->hasDefault())
|
} else if (!var->hasDefault() && !var->isStatic())
|
||||||
needInitialization = true;
|
needInitialization = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4832,6 +4832,18 @@ private:
|
||||||
" if (!isNull) {}\n"
|
" if (!isNull) {}\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #10119
|
||||||
|
valueFlowUninit("struct Foo {\n"
|
||||||
|
" int i{};\n"
|
||||||
|
" static const float cf;\n"
|
||||||
|
"};\n"
|
||||||
|
"const float Foo::cf = 0.1f;\n"
|
||||||
|
"int bar() {\n"
|
||||||
|
" Foo f;\n"
|
||||||
|
" return f.i;\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_ipa() {
|
void uninitvar_ipa() {
|
||||||
|
|
Loading…
Reference in New Issue