parse.y (bad_decl, [...]): New nonterminals.
authorGerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
Thu, 22 Mar 2001 18:44:21 +0000 (19:44 +0100)
committerGerald Pfeifer <gerald@gcc.gnu.org>
Thu, 22 Mar 2001 18:44:21 +0000 (18:44 +0000)
* parse.y (bad_decl, template_arg_list_ignore, arg_list_ignore):
New nonterminals.
(data_def, component_decl): Add reductions to bad_decl.

Co-Authored-By: Joe Buck <jbuck@synopsys.com>
From-SVN: r40752

gcc/cp/ChangeLog
gcc/cp/parse.y

index d2c9217b29ea6ac11e12baab026344bc9b129a29..bdce0cea9ca19200442047dbc04cc58835339a9e 100644 (file)
@@ -1,3 +1,10 @@
+2001-03-22  Gerald Pfeifer  <pfeifer@dbai.tuwien.ac.at>
+            based on an idea from Joe Buck <jbuck@synopsys.com>
+
+       * parse.y (bad_decl, template_arg_list_ignore, arg_list_ignore):
+       New nonterminals.
+       (data_def, component_decl): Add reductions to bad_decl.
+
 2001-03-22  Jakub Jelinek  <jakub@redhat.com>
 
        * method.c (do_build_assign_ref): Don't use build_modify_expr for
index 59ad4e6106424e7dc0a4534fecca9f0faf237333..3d4ab4400f671d6dd909156ecb15ff47d32d94fe 100644 (file)
@@ -733,6 +733,7 @@ datadef:
        | error ';'
        | error '}'
        | ';'
+       | bad_decl
        ;
 
 ctor_initializer_opt:
@@ -2590,6 +2591,8 @@ component_decl:
                  $$ = finish_member_class_template ($2.t); 
                  finish_template_decl ($1);
                }
+       | bad_decl
+               { $$ = NULL_TREE; }
        ;
 
 component_decl_1:
@@ -3761,6 +3764,26 @@ bad_parm:
                }
        ;
 
+bad_decl:
+          IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore ';'
+               {
+                  cp_error("'%D' is used as a type, but is not defined as a type.", $1);
+                  $3 = error_mark_node;
+               }
+        ;
+
+template_arg_list_ignore:
+          '<' template_arg_list_opt template_close_bracket
+               { }
+       | /* empty */
+       ;
+
+arg_list_ignore:
+          '(' nonnull_exprlist ')'
+               { }
+       | /* empty */
+       ;
+
 exception_specification_opt:
          /* empty */  %prec EMPTY
                { $$ = NULL_TREE; }