compiler: fix an ICE when parsing 0xdie, reject token 0x123i.

The lexer used to incorrectly accept a token like 0x123i
and interpreted it as 123i. It also used to die when encountering
0xdie.

From-SVN: r187266
This commit is contained in:
Ian Lance Taylor 2012-05-07 18:53:28 +00:00
parent ca30ba74c9
commit 62beea506b
1 changed files with 3 additions and 1 deletions

View File

@ -1012,7 +1012,9 @@ Lex::gather_number()
}
}
if (*p != '.' && *p != 'i' && !Lex::could_be_exponent(p, pend))
// A partial token that looks like an octal literal might actually be the
// beginning of a floating-point or imaginary literal.
if (base == 16 || (*p != '.' && *p != 'i' && !Lex::could_be_exponent(p, pend)))
{
std::string s(pnum, p - pnum);
mpz_t val;