diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index c7b67cdee..746811d66 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -6211,8 +6211,6 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source for (const Token* child = parent->astOperand1(); child;) { if (Token::Match(child, ".|::")) child = child->astOperand2(); - else if (Token::simpleMatch(child, "[")) - child = child->astOperand1(); else { isArrayToPointerDecay = child->variable() && child->variable()->isArray(); break; diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index d7ebfd425..e2add4155 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -7602,6 +7602,7 @@ private: ASSERT_EQUALS("", typeOf("a = x[\"hello\"];", "[", "test.cpp")); ASSERT_EQUALS("const char", typeOf("a = x[\"hello\"];", "[", "test.c")); ASSERT_EQUALS("signed int *", typeOf("int x[10]; a = &x;", "&")); + ASSERT_EQUALS("signed int *", typeOf("int x[10]; a = &x[1];", "&")); // cast.. ASSERT_EQUALS("void *", typeOf("a = (void *)0;", "("));