}
/* Complain about missing 'typename' or other invalid type names. */
- if (!decl_specifiers.any_type_specifiers_p)
- cp_parser_parse_and_diagnose_invalid_type_name (parser);
+ if (!decl_specifiers.any_type_specifiers_p
+ && cp_parser_parse_and_diagnose_invalid_type_name (parser))
+ {
+ /* cp_parser_parse_and_diagnose_invalid_type_name calls
+ cp_parser_skip_to_end_of_block_or_statement, so don't try to parse
+ the rest of this declaration. */
+ decl = error_mark_node;
+ goto out;
+ }
/* If it's not a template class, try for a template function. If
the next token is a `;', then this declaration does not declare
}
}
+ /* Look for a trailing `;' after the declaration. */
+ if (!function_definition_p
+ && (decl == error_mark_node
+ || !cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON)))
+ cp_parser_skip_to_end_of_block_or_statement (parser);
+
+ out:
pop_deferring_access_checks ();
/* Clear any current qualification; whatever comes next is the start
parser->scope = NULL_TREE;
parser->qualifying_scope = NULL_TREE;
parser->object_scope = NULL_TREE;
- /* Look for a trailing `;' after the declaration. */
- if (!function_definition_p
- && (decl == error_mark_node
- || !cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON)))
- cp_parser_skip_to_end_of_block_or_statement (parser);
return decl;
}
+2011-03-10 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/syntax-err1.C: New.
+ * g++.dg/parse/error36.C: Adjust expected errors.
+ * g++.old-deja/g++.pt/ctor2.C: Likewise.
+ * g++.old-deja/g++.pt/typename3.C: Likewise.
+ * g++.old-deja/g++.pt/typename4.C: Likewise.
+ * g++.old-deja/g++.pt/typename6.C: Likewise.
+
2011-03-09 Jason Merrill <jason@redhat.com>
* g++.dg/template/nontype22.C: New.