re PR c++/17595 (Unfriendly error message/rejects legal #pragmas in the middle of a parameter list)

PR c++/17595
	* parser.c (cp_parser_error): Issue better messages about
	#pragma in locations where it is not permitted.

From-SVN: r92572
This commit is contained in:
Mark Mitchell 2004-12-23 22:07:01 +00:00 committed by Mark Mitchell
parent 058e32b336
commit 0d63048c5b
2 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2004-12-23 Mark Mitchell <mark@codesourcery.com>
PR c++/17595
* parser.c (cp_parser_error): Issue better messages about
#pragma in locations where it is not permitted.
PR c++/17413
* pt.c (check_instantiated_args): Remove bogus SFINAE code.

View File

@ -1784,6 +1784,12 @@ cp_parser_error (cp_parser* parser, const char* message)
/* This diagnostic makes more sense if it is tagged to the line
of the token we just peeked at. */
cp_lexer_set_source_position_from_token (token);
if (token->type == CPP_PRAGMA)
{
error ("%<#pragma%> is not allowed here");
cp_lexer_purge_token (parser->lexer);
return;
}
c_parse_error (message,
/* Because c_parser_error does not understand
CPP_KEYWORD, keywords are treated like