Fixed #8581 (Delegating contructor warns for unintialized variables) (#1250)

* Fixed #8581 (Delegating contructor warns for unintialized variables)

* Replace Token::Match with isStandardType
This commit is contained in:
IOBYTE 2018-05-20 16:58:05 -04:00 committed by Daniel Marjamäki
parent 9b28499412
commit 42ed5a6b98
2 changed files with 17 additions and 0 deletions

View File

@ -5310,6 +5310,13 @@ void SymbolDatabase::setValueTypeInTokenList()
}
}
// function style cast
else if (tok->previous() && tok->previous()->isStandardType()) {
ValueType valuetype;
valuetype.type = ValueType::typeFromString(tok->previous()->str(), tok->previous()->isLong());
setValueType(tok, valuetype);
}
// library function
else if (tok->previous()) {
const std::string& typestr(_settings->library.returnValueType(tok->previous()));

View File

@ -1088,6 +1088,16 @@ private:
"\n"
"A::A() noexcept: A(0) {}");
ASSERT_EQUALS("", errout.str());
// Ticket #8581
check("class A {\n"
"private:\n"
" int _a;\n"
"public:\n"
" A(int a) : _a(a) {}\n"
" A(float a) : A(int(a)) {}\n"
"};");
ASSERT_EQUALS("", errout.str());
}