[patch, 3.4] Fix PR c++/19397, c++/19762, c++/19764

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Dec 7 19:00:00 GMT 2005


Volker Reichelt <reichelt@igpm.rwth-aachen.de> writes:

| The following patch fixes some ice-on-invalid-code bugs in the C++
| frontend on the 3.4 branch.
| 
| The culprit is the following code from cp_parser_declarator_id:
| 
|   id_expression = cp_parser_id_expression (parser,
| 					   /*template_keyword_p=*/false,
| 					   /*check_dependency_p=*/false,
| 					   /*template_p=*/NULL,
| 					   /*declarator_p=*/true);
|   /* If the name was qualified, create a SCOPE_REF to represent that.  */
|   if (parser->scope)
|     {
|       id_expression = build_nt (SCOPE_REF, parser->scope, id_expression);
|       parser->scope = NULL_TREE;
|     }
| 
|   return id_expression;
| 
| If cp_parser_id_expression returns an error_mark_node we shouldn't
| be building a SCOPE_REF with it, but instead return an error_mark_node.
| The following patch does that by also checking for
|   id_expression != error_mark_node
| in the if statement.
| 
| The testcase g++.dg/template/dtor3.C for PR c++/1976[24] is already
| present on the 3.4 branch, but doesn't complain about the ICE because
| of the catch-all { dg-error "" } in the last line. The patch also
| fixes that.

Yeah, I discovered the hard way recently that it actually mask ICEs
too :-(  

| Bootstrapped and regtested on x86_64-unknown-linux-gnu.
| Ok for the 3.4 branch.

Yes, thanks for your patience.

-- Gaby



More information about the Gcc-patches mailing list