Hi,

On 18/05/2016 17:17, Jason Merrill wrote:
On 05/18/2016 11:05 AM, Paolo Carlini wrote:
On 18/05/2016 16:39, Jason Merrill wrote:
On 05/17/2016 04:47 PM, Paolo Carlini wrote:
this ICE during error recovery exposes a rather more general weakness:
we should never call cp_lexer_peek_nth_token (*, 2) when a previous
cp_lexer_peek_token returns CPP_EOF.

Hmm, that seems fragile, I would expect it to keep returning EOF.

Indeed. I didn't explain myself well enough. I meant something along the
lines: outside this specific and minor case of ICE during error
recovery, we should audit our code and keep in mind that calling
cp_lexer_peek_nth_token (*, anything > 1, the common case) right after
cp_lexer_peek_token is, how shall I put it, "suspect", due to that
assert at the beginning of cp_lexer_peek_nth_token.

I understood that, but I think that assert should be replaced with code to properly handle that case.
Ah yes, that comment before cp_lexer_peek_nth_token. I read it yesterday, got interested, but afterward focused on the specific issue in the bug report, seemed easy to fix.

Paolo.

Reply via email to