diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-12-23 22:07:01 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-12-23 22:07:01 +0000 |
commit | 0d63048c5b05fff144a7b3b8103cedf14839cac4 (patch) | |
tree | 136d2b960d550dd2f69a786e64f54a8059c8b09d /gcc | |
parent | 058e32b336f75d77847ecdd938cb30ff493b9018 (diff) | |
download | gcc-0d63048c5b05fff144a7b3b8103cedf14839cac4.zip gcc-0d63048c5b05fff144a7b3b8103cedf14839cac4.tar.gz gcc-0d63048c5b05fff144a7b3b8103cedf14839cac4.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parser.c | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 04ec946..cf9a42c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5654f11..2a72a5e 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 |