]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/17595 (Unfriendly error message/rejects legal #pragmas in the middle of...
authorMark Mitchell <mark@codesourcery.com>
Thu, 23 Dec 2004 22:07:01 +0000 (22:07 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 23 Dec 2004 22:07:01 +0000 (22:07 +0000)
PR c++/17595
* parser.c (cp_parser_error): Issue better messages about
#pragma in locations where it is not permitted.

From-SVN: r92572

gcc/cp/ChangeLog
gcc/cp/parser.c

index 04ec9463dd95c2ff0f0474c59249b6946a542ffb..cf9a42c9f8a8254bdf11a43708f390eb5e675d53 100644 (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.
 
index 5654f11dcd4520fc3b09a199a1ac898afee80f72..2a72a5ed3352c164d9c7397a6a9e50f7ec840fc6 100644 (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
This page took 0.088122 seconds and 5 git commands to generate.