parent
6c55f9cf88
commit
9fda86eb6d
|
@ -893,7 +893,7 @@ void SymbolDatabase::createSymbolDatabaseNeedInitialization()
|
|||
if (var.isClass()) {
|
||||
if (var.type()) {
|
||||
// does this type need initialization?
|
||||
if (var.type()->needInitialization == Type::NeedInitialization::True)
|
||||
if (var.type()->needInitialization == Type::NeedInitialization::True && !var.hasDefault())
|
||||
needInitialization = true;
|
||||
else if (var.type()->needInitialization == Type::NeedInitialization::Unknown) {
|
||||
if (!(var.valueType() && var.valueType()->type == ValueType::CONTAINER))
|
||||
|
|
|
@ -93,6 +93,7 @@ private:
|
|||
TEST_CASE(noConstructor10); // ticket #6614
|
||||
TEST_CASE(noConstructor11); // ticket #3552
|
||||
TEST_CASE(noConstructor12); // #8951 - member initialization
|
||||
TEST_CASE(noConstructor13); // #9998
|
||||
|
||||
TEST_CASE(forwardDeclaration); // ticket #4290/#3190
|
||||
|
||||
|
@ -633,6 +634,16 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void noConstructor13() { // #9998
|
||||
check("struct C { int v; };\n"
|
||||
"struct B { C c[5] = {}; };\n"
|
||||
"struct A {\n"
|
||||
" A() {}\n"
|
||||
" B b;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
// ticket #4290 "False Positive: style (noConstructor): The class 'foo' does not have a constructor."
|
||||
// ticket #3190 "SymbolDatabase: Parse of sub class constructor fails"
|
||||
void forwardDeclaration() {
|
||||
|
|
Loading…
Reference in New Issue