Fixed #7966 (ValueType: wrong type for gcc initialization {[1]=..})
This commit is contained in:
parent
16f9e1646c
commit
164df2aa7b
|
@ -4578,7 +4578,7 @@ void SymbolDatabase::setValueType(Token *tok, const ValueType &valuetype)
|
|||
return;
|
||||
}
|
||||
|
||||
if (parent->str() == "[" && (!cpp || parent->astOperand1() == tok) && valuetype.pointer > 0U) {
|
||||
if (parent->str() == "[" && (!cpp || parent->astOperand1() == tok) && valuetype.pointer > 0U && !Token::Match(parent->previous(), "[{,]")) {
|
||||
const Token *op1 = parent->astOperand1();
|
||||
while (op1 && op1->str() == "[")
|
||||
op1 = op1->astOperand1();
|
||||
|
|
|
@ -4429,6 +4429,7 @@ private:
|
|||
|
||||
// Variable declaration
|
||||
ASSERT_EQUALS("char *", typeOf("; char abc[] = \"abc\";", "["));
|
||||
ASSERT_EQUALS("", typeOf("; int x[10] = { [3]=1 };", "[ 3 ]"));
|
||||
}
|
||||
|
||||
void variadic1() { // #7453
|
||||
|
|
Loading…
Reference in New Issue