This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Don't treat 0x123i as 123i
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Mon, 07 May 2012 11:53:46 -0700
- Subject: Go patch committed: Don't treat 0x123i as 123i
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;