https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99446
Bernd Edlinger <bernd.edlinger at hotmail dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernd.edlinger at hotmail dot de --- Comment #7 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- Hmm, I don't fully understand what's the reason why the assertion fires here. ... but what's apparently wrong here, is the location before the EOF is in a different file. While it was intended to show the line above the end-of-file, it was likely not intended to show the last token in a different include file? So something like that fixes the test case: diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 59adac4..99026f4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -668,7 +668,8 @@ cp_lexer_new_main (void) + lexer->buffer->length () - 1; - if (lexer->buffer->length () != 1) + if (lexer->buffer->length () != 1 + && LOCATION_FILE (tok[-1].location) == LOCATION_FILE(tok[0].location)) { /* Set the EOF token's location to be the just after the previous token's range. That way 'at-eof' diagnostics point at something