Fix false positive AssignmentIntegerToAddress (#2971)
This commit is contained in:
parent
b091eaccbe
commit
aad723bf3a
|
@ -5912,6 +5912,9 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
|
|||
}
|
||||
type = type->next();
|
||||
}
|
||||
if (type->str() == "(" && type->previous()->function())
|
||||
// we are past the end of the type
|
||||
type = type->previous();
|
||||
continue;
|
||||
} else if (settings->library.isSmartPointer(type)) {
|
||||
const Token* argTok = Token::findsimplematch(type, "<");
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
|
||||
// Tokenize..
|
||||
Tokenizer tokenizer(&settings, this);
|
||||
LOAD_LIB_2(settings.library, "std.cfg");
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
|
||||
|
@ -104,6 +105,32 @@ private:
|
|||
" return a;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("std::array<int,2> f();\n"
|
||||
"void g() {\n"
|
||||
" std::array<int, 2> a = f();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("std::array<int,2> f(int x);\n"
|
||||
"void g(int i) {\n"
|
||||
" std::array<int, 2> a = f(i);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("typedef std::array<int, 2> Array;\n"
|
||||
"Array f(int x);\n"
|
||||
"void g(int i) {\n"
|
||||
" Array a = f(i);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("typedef std::array<int, 2> Array;\n"
|
||||
"Array f();\n"
|
||||
"void g(int i) {\n"
|
||||
" Array a = f();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void structmember() {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue