Skip to content

Commit e45e5f9

Browse files
committed
SymbolDatabase: fix ValueType for '&array[x]'
1 parent ecb2938 commit e45e5f9

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

lib/symboldatabase.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6211,8 +6211,6 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
62116211
for (const Token* child = parent->astOperand1(); child;) {
62126212
if (Token::Match(child, ".|::"))
62136213
child = child->astOperand2();
6214-
else if (Token::simpleMatch(child, "["))
6215-
child = child->astOperand1();
62166214
else {
62176215
isArrayToPointerDecay = child->variable() && child->variable()->isArray();
62186216
break;

test/testsymboldatabase.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7602,6 +7602,7 @@ class TestSymbolDatabase : public TestFixture {
76027602
ASSERT_EQUALS("", typeOf("a = x[\"hello\"];", "[", "test.cpp"));
76037603
ASSERT_EQUALS("const char", typeOf("a = x[\"hello\"];", "[", "test.c"));
76047604
ASSERT_EQUALS("signed int *", typeOf("int x[10]; a = &x;", "&"));
7605+
ASSERT_EQUALS("signed int *", typeOf("int x[10]; a = &x[1];", "&"));
76057606

76067607
// cast..
76077608
ASSERT_EQUALS("void *", typeOf("a = (void *)0;", "("));

0 commit comments

Comments
 (0)