Fixed #1052 (Internal error for 'int vals[] = { 0x13, 1?0x01:0x00 };')

This commit is contained in:
Daniel Marjamäki 2009-12-06 10:58:27 +01:00
parent a5e43b4be5
commit cd4e355f17
2 changed files with 12 additions and 2 deletions

View File

@ -2717,12 +2717,12 @@ bool Tokenizer::simplifyQuestionMark()
break;
}
else if (end->str() == "(")
else if (Token::Match(end, "[({[]"))
{
++ind;
}
else if (end->str() == ")")
else if (Token::Match(end, "[)}]]"))
{
--ind;
if (ind < 0)

View File

@ -1810,6 +1810,16 @@ private:
"}\n";
ASSERT_EQUALS("void f ( ) { bool x ; x = false ; int b ; b = 3 ; }", tok(code));
}
{
const char code[] = "int vals[] = { 0x13, 1?0x01:0x00 };";
ASSERT_EQUALS("int * vals ; vals = { 19 , 1 } ;", tok(code));
}
{
const char code[] = "int vals[] = { 0x13, 0?0x01:0x00 };";
ASSERT_EQUALS("int * vals ; vals = { 19 , 0 } ;", tok(code));
}
}
void calculations()