diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index dfa75810b..c42a7151b 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3303,7 +3303,7 @@ void Tokenizer::setVarId() // If pattern is "( %type% *|& %var% )" then check if it's a // variable declaration or a multiplication / mask - if (Token::Match(tok, "( %type% *|& %var% )") && !tok->next()->isStandardType()) + if (Token::Match(tok, "( %type% *|& %var% [),]") && !tok->next()->isStandardType()) { if (!Token::Match(tok->previous(), "%type%")) continue; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index ee5207b96..dfa87d3bb 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -2722,6 +2722,7 @@ private: void varidFunctionCall2() { + // #2491 const std::string code("void f(int b) {\n" " x(a*b,10);\n" "}"); @@ -2730,8 +2731,7 @@ private: "2: x ( a * b"); const std::string expected2(" , 10 ) ;\n" "3: }\n"); - TODO_ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code)); - ASSERT_EQUALS(expected1+"@2"+expected2, tokenizeDebugListing(code)); + ASSERT_EQUALS(expected1+"@1"+expected2, tokenizeDebugListing(code)); } void varidFunctionCall3() @@ -2751,7 +2751,6 @@ private: ASSERT_EQUALS(expected, tokenizeDebugListing(code)); } - void varidStl() { const std::string actual = tokenizeDebugListing(