Fixed #4430 (FP: Member variable is not initialized in the constructor.)

This commit is contained in:
Robert Reif 2012-12-23 08:04:44 +01:00 committed by Daniel Marjamäki
parent 47e1a571f7
commit dae232015e
2 changed files with 12 additions and 1 deletions

View File

@ -4607,7 +4607,7 @@ bool Tokenizer::simplifyFunctionParameters()
}
// Find the function e.g. foo( x ) or foo( x, y )
else if (Token::Match(tok, "%var% ( %var% [,)]")) {
else if (Token::Match(tok, "%var% ( %var% [,)]") && tok->strAt(-1) != ":") {
// We have found old style function, now we need to change it
// First step: Get list of argument names in parenthesis

View File

@ -290,6 +290,7 @@ private:
TEST_CASE(simplifyFunctionParameters);
TEST_CASE(simplifyFunctionParameters1); // #3721
TEST_CASE(simplifyFunctionParameters2); // #4430
TEST_CASE(simplifyFunctionParametersErrors);
TEST_CASE(removeParentheses1); // Ticket #61
@ -4685,6 +4686,16 @@ private:
"}", tokenizeAndStringify(code));
}
void simplifyFunctionParameters2() { // #4430
const char code[] = "class Item { "
"int i ; "
"public: "
"Item ( int i ) ; "
"} ; "
"Item :: Item ( int i ) : i ( i ) { }";
ASSERT_EQUALS(code, tokenizeAndStringify(code));
}
void simplifyFunctionParametersErrors() {
//same parameters...
tokenizeAndStringify("void foo(x, x)\n"