https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88036
David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-11-15 Ever confirmed|0 |1 --- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Confirmed. Currently unqualified_name_lookup_error makes a VAR_DECL for "undeclared_type". Perhaps it should make an opaque type instead for this case? 519 /* Prevent repeated error messages by creating a VAR_DECL with 520 this NAME in the innermost block scope. */ 521 if (local_bindings_p ()) 522 { 523 tree decl = build_decl (loc, VAR_DECL, name, error_mark_node); 524 TREE_USED (decl) = true; 525 pushdecl (decl); 526 } The "fool" token at the "decl" gets consumed within cp_parser_expression_statement here: 11225 statement = cp_parser_expression (parser); 11226 if (statement == error_mark_node 11227 && !cp_parser_uncommitted_to_tentative_parse_p (parser)) 11228 { 11229 cp_parser_skip_to_end_of_block_or_statement (parser); 11230 return error_mark_node;