This patch from Rémy Oudompheng fixes the Go frontend lexer to not treat
0x123i as 123i. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch.
Ian
diff -r 8671bcd0c298 go/lex.cc
--- a/go/lex.cc Mon May 07 11:35:33 2012 -0700
+++ b/go/lex.cc Mon May 07 11:50:46 2012 -0700
@@ -1012,7 +1012,9 @@
}
}
- 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;