rsmith added a comment.

The lexer is doing the right thing; per the C++ lexical rules, the `+1` is not 
part of the token in this case.

I don't think this fix is in the right place; we will still examine characters 
after the end of the literal, even with this applied, and that doesn't seem 
right to me (even though the literal parser is constructed in such a way that 
it is valid to do so, as long as it doesn't read past a nul byte). It looks 
like the problem is that `NumericLiteralParser::ParseDecimalOrOctalCommon` will 
examine `*s` in cases where it might point past the end of the literal; changing

  if (*s == '+' || *s == '-')  s++; // sign

to

  if (s != ThisTokEnd && (*s == '+' || *s == '-'))  s++; // sign

would seem appropriate. But I think I'd be most in favor of that change plus 
your change plus a change to suppress the "no digits in suffix" error if we've 
already had an error. Seem reasonable?


https://reviews.llvm.org/D41834



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to