Fixed #7447 (FP: ignoredReturnValue on C++11 uniform initialization)
This commit is contained in:
parent
f1bf5cc4e2
commit
7c800d6ed7
|
@ -156,6 +156,10 @@ void CheckFunctions::checkIgnoredReturnValue()
|
||||||
for (std::size_t i = 0; i < functions; ++i) {
|
for (std::size_t i = 0; i < functions; ++i) {
|
||||||
const Scope * scope = symbolDatabase->functionScopes[i];
|
const Scope * scope = symbolDatabase->functionScopes[i];
|
||||||
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) {
|
||||||
|
// c++11 initialization
|
||||||
|
if (Token::Match(tok, "%var% {"))
|
||||||
|
tok = tok->linkAt(1);
|
||||||
|
|
||||||
if (tok->varId() || !Token::Match(tok, "%name% (") || tok->strAt(-1) == ".")
|
if (tok->varId() || !Token::Match(tok, "%name% (") || tok->strAt(-1) == ".")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -894,6 +894,13 @@ private:
|
||||||
" void * res{malloc(size)};\n"
|
" void * res{malloc(size)};\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #7447
|
||||||
|
check("void foo() {\n"
|
||||||
|
" int x{mystrcmp(a,b)};\n"
|
||||||
|
"}", "test.cpp", &settings2);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue