parent
948bb8df94
commit
47ba053054
|
@ -1593,7 +1593,7 @@ void CheckOther::checkConstPointer()
|
|||
if (nonConstPointers.find(p) == nonConstPointers.end()) {
|
||||
const Token *start = (p->isArgument()) ? p->scope()->bodyStart : p->nameToken()->next();
|
||||
const int indirect = p->isArray() ? p->dimensions().size() : 1;
|
||||
if (isVariableChanged(start, p->scope()->bodyEnd, indirect, p->declarationId(), false, mSettings, mTokenizer->isCPP()))
|
||||
if (p->isStatic() || isVariableChanged(start, p->scope()->bodyEnd, indirect, p->declarationId(), false, mSettings, mTokenizer->isCPP()))
|
||||
continue;
|
||||
constVariableError(p, nullptr);
|
||||
}
|
||||
|
|
|
@ -2971,6 +2971,13 @@ private:
|
|||
" istr >> x[0];\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #10744
|
||||
check("S& f() {\n"
|
||||
" static S * p = new S();\n"
|
||||
" return *p;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void switchRedundantAssignmentTest() {
|
||||
|
|
|
@ -2206,6 +2206,19 @@ private:
|
|||
"} ;",
|
||||
tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
{
|
||||
// Ticket #9515
|
||||
const char code[] = "void(a)(void) {\n"
|
||||
" static int b;\n"
|
||||
" if (b) {}\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS("void ( a ) ( void ) {\n"
|
||||
"static int b ;\n"
|
||||
"if ( b ) { }\n"
|
||||
"}",
|
||||
tokenizeAndStringify(code));
|
||||
}
|
||||
}
|
||||
|
||||
void vardecl6() {
|
||||
|
|
Loading…
Reference in New Issue