* Fix #11460 unintvar false positive * Format
This commit is contained in:
parent
11f1a9d1f5
commit
f793b7dd35
|
@ -929,7 +929,7 @@ void SymbolDatabase::createSymbolDatabaseNeedInitialization()
|
||||||
if (var.isClass()) {
|
if (var.isClass()) {
|
||||||
if (var.type()) {
|
if (var.type()) {
|
||||||
// does this type need initialization?
|
// does this type need initialization?
|
||||||
if (var.type()->needInitialization == Type::NeedInitialization::True && !var.hasDefault())
|
if (var.type()->needInitialization == Type::NeedInitialization::True && !var.hasDefault() && !var.isStatic())
|
||||||
needInitialization = true;
|
needInitialization = true;
|
||||||
else if (var.type()->needInitialization == Type::NeedInitialization::Unknown) {
|
else if (var.type()->needInitialization == Type::NeedInitialization::Unknown) {
|
||||||
if (!(var.valueType() && var.valueType()->type == ValueType::CONTAINER))
|
if (!(var.valueType() && var.valueType()->type == ValueType::CONTAINER))
|
||||||
|
|
|
@ -6249,6 +6249,18 @@ private:
|
||||||
" S s2 = s1;\n"
|
" S s2 = s1;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #11460
|
||||||
|
valueFlowUninit("struct B { int i; };\n"
|
||||||
|
" struct H {\n"
|
||||||
|
" void e() const;\n"
|
||||||
|
" static const B b;\n"
|
||||||
|
"};\n"
|
||||||
|
"void f() {\n"
|
||||||
|
" H h;\n"
|
||||||
|
" h.e();\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_memberfunction() {
|
void uninitvar_memberfunction() {
|
||||||
|
|
Loading…
Reference in New Issue