diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 0ad9ddef1d6..be923628244 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5062,7 +5062,7 @@ void Tokenizer::setVarIdPass1() if (tok3->isLiteral() || (tok3->isName() && (variableMap.hasVariable(tok3->str()) || - (tok3->strAt(-1) == "(" && Token::simpleMatch(tok3->next(), "(") && !Token::simpleMatch(tok3->linkAt(1)->next(), "(")))) || + (tok3->strAt(-1) == "(" && Token::simpleMatch(tok3->next(), "(") && !Token::Match(tok3->linkAt(1)->next(), "(|[")))) || tok3->isOp() || tok3->str() == "(" || notstart.find(tok3->str()) != notstart.end()) { diff --git a/test/testvarid.cpp b/test/testvarid.cpp index a1874d3c5f2..2a489772673 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -1630,12 +1630,14 @@ class TestVarID : public TestFixture { "A f(3);\n" "A f2(true);\n" "A g();\n" - "A e(int c);\n", dinit(TokenizeOptions, $.cpp = false)); + "A e(int c);\n" + "A h(T (*p)[16]);\n", dinit(TokenizeOptions, $.cpp = false)); const char expected[] = "1: A f@1 ( 3 ) ;\n" "2: A f2@2 ( true ) ;\n" "3: A g ( ) ;\n" - "4: A e ( int c@3 ) ;\n"; + "4: A e ( int c@3 ) ;\n" + "5: A h ( T ( * p@4 ) [ 16 ] ) ;\n"; ASSERT_EQUALS(expected, actual); }