------- Comment #4 from jakub at gcc dot gnu dot org 2008-11-11 15:42 ------- The joys (well, lack thereof) of tentative parsing. No errors are reported because cp_parser_decl_specifier_seq (and its caller cp_parser_simple_declaration) is called during tentative parsing. cp_parser_decl_specifier_seq returns error_mark_node type, but any_specifiers_p is set, so cp_parser_simple_declaration calls: 8172 /* If we have seen at least one decl-specifier, and the next token 8173 is not a parenthesis, then we must be looking at a declaration. 8174 (After "int (" we might be looking at a functional cast.) */ 8175 if (decl_specifiers.any_specifiers_p 8176 && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN) 8177 && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) 8178 cp_parser_commit_to_tentative_parse (parser); Type being error_mark_node generally means that routines assume that error has been reported already, so nothing is diagnosed afterwards.
Mark, how should this be fixed up? If cp_parser_decltype (and cp_parser_simple_type_specifier) knew one of the callers is going to call cp_parser_commit_to_tentative_parse, it could cp_parser_commit_to_tentative_parse first and let all the errors be reported right away. But I doubt it can. Another possibility would be add support for queing error messages during tentative parsing and at cp_parser_commit_to_tentative_parse emit them. -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mmitchel at gcc dot gnu dot | |org, jason at gcc dot gnu | |dot org, dodji at gcc dot | |gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34269