Partial fix for #8291: (False positive uninitMemberVar when calling delegated constructor) (#1142)

This commit is contained in:
IOBYTE 2018-04-04 02:29:12 -04:00 committed by Daniel Marjamäki
parent 3cc3bd7066
commit fa968d75bd
2 changed files with 10 additions and 1 deletions

View File

@ -5030,7 +5030,7 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
valuetype->type = ValueType::Type::INT; valuetype->type = ValueType::Type::INT;
} else } else
valuetype->type = ValueType::Type::RECORD; valuetype->type = ValueType::Type::RECORD;
while (Token::Match(type, "%name%|*|&|::") && !type->variable()) { while (Token::Match(type, "%name%|*|&|::") && !type->variable() && !type->function()) {
if (type->isSigned()) if (type->isSigned())
valuetype->sign = ValueType::Sign::SIGNED; valuetype->sign = ValueType::Sign::SIGNED;
else if (type->isUnsigned()) else if (type->isUnsigned())

View File

@ -6208,6 +6208,15 @@ private:
" char s;\n" " char s;\n"
"};"); "};");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkInitializationListUsage("unsigned bar(std::string);\n" // #8291
"class Foo {\n"
"public:\n"
" int a_, b_;\n"
" Foo(int a, int b) : a_(a), b_(b) {}\n"
" Foo(int a, const std::string& b) : Foo(a, bar(b)) {}\n"
"};");
ASSERT_EQUALS("", errout.str());
} }