re PR c++/12132 (spurious "int ._0" (or "int $_0) in error message)

PR c++/12132
	* parser.c (cp_parser_explicit_instantiation): Improve error
	recovery.
	(cp_parser_require): Improve indication of the error location.

	PR c++/12132
	* g++.dg/template/error11.C: New test.

From-SVN: r75441
This commit is contained in:
Mark Mitchell 2004-01-05 21:07:22 +00:00 committed by Mark Mitchell
parent 8808159929
commit 216bb6e1f7
4 changed files with 33 additions and 8 deletions

View File

@ -1,5 +1,10 @@
2004-01-05 Mark Mitchell <mark@codesourcery.com>
PR c++/12132
* parser.c (cp_parser_explicit_instantiation): Improve error
recovery.
(cp_parser_require): Improve indication of the error location.
PR c++/13451
* parser.c (cp_parser_class_head): Reorder logic to check for
invalid qualification.

View File

@ -8392,13 +8392,22 @@ cp_parser_explicit_instantiation (cp_parser* parser)
/*parenthesized_p=*/NULL);
cp_parser_check_for_definition_in_return_type (declarator,
declares_class_or_enum);
decl = grokdeclarator (declarator, decl_specifiers,
NORMAL, 0, NULL);
/* Turn access control back on for names used during
template instantiation. */
pop_deferring_access_checks ();
/* Do the explicit instantiation. */
do_decl_instantiation (decl, extension_specifier);
if (declarator != error_mark_node)
{
decl = grokdeclarator (declarator, decl_specifiers,
NORMAL, 0, NULL);
/* Turn access control back on for names used during
template instantiation. */
pop_deferring_access_checks ();
/* Do the explicit instantiation. */
do_decl_instantiation (decl, extension_specifier);
}
else
{
pop_deferring_access_checks ();
/* Skip the body of the explicit instantiation. */
cp_parser_skip_to_end_of_statement (parser);
}
}
/* We're done with the instantiation. */
end_explicit_instantiation ();
@ -14630,7 +14639,11 @@ cp_parser_require (cp_parser* parser,
{
/* Output the MESSAGE -- unless we're parsing tentatively. */
if (!cp_parser_simulate_error (parser))
error ("expected %s", token_desc);
{
char *message = concat ("expected ", token_desc, NULL);
cp_parser_error (parser, message);
free (message);
}
return NULL;
}
}

View File

@ -1,5 +1,8 @@
2004-01-05 Mark Mitchell <mark@codesourcery.com>
PR c++/12132
* g++.dg/template/error11.C: New test.
PR c++/13451
* g++.dg/template/class2.C: New test.

View File

@ -0,0 +1,4 @@
// PR c++/12132
inline template <int> void foo () {} // { dg-error "<" }
void abort (); // { dg-error ";" }