1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 89, 93, 94, 95, 1996 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 /* This grammar is based on the GNU CC grammar. */
25 /* Note: Bison automatically applies a default action of "$$ = $1" for
26 all derivations; this is applied before the explicit action, if one
27 is given. Keep this in mind when reading the actions. */
30 /* Cause the `yydebug' variable to be defined. */
46 /* Since parsers are distinct for each language, put the language string
47 definition here. (fnf) */
48 char *language_string = "GNU C++";
50 extern tree void_list_node;
51 extern struct obstack permanent_obstack;
57 extern int end_of_file;
58 extern int current_class_depth;
59 extern tree last_tree;
61 /* FSF LOCAL dje prefix attributes */
62 extern tree strip_attrs PROTO((tree));
65 /* Like YYERROR but do call yyerror. */
66 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
68 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
69 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
71 /* Contains the statement keyword (if/while/do) to include in an
72 error message if the user supplies an empty conditional expression. */
73 static char *cond_stmt_keyword;
75 static tree empty_parms PROTO((void));
77 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
81 /* Cons up an empty parameter list. */
91 || current_class_type != NULL)
92 parms = void_list_node;
101 %union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; }
103 /* All identifiers that are not reserved words
104 and are not declared typedefs in the current block */
107 /* All identifiers that are declared typedefs in the current block.
108 In some contexts, they are treated just like IDENTIFIER,
109 but they can also serve as typespecs in declarations. */
113 /* Reserved words that specify storage class.
114 yylval contains an IDENTIFIER_NODE which indicates which one. */
117 /* Reserved words that specify type.
118 yylval contains an IDENTIFIER_NODE which indicates which one. */
121 /* Reserved words that qualify type: "const" or "volatile".
122 yylval contains an IDENTIFIER_NODE which indicates which one. */
125 /* Character or numeric constants.
126 yylval is the node for the constant. */
129 /* String constants in raw form.
130 yylval is a STRING_CST node. */
133 /* "...", used for functions with variable arglists. */
136 /* the reserved words */
137 /* SCO include files test "ASM", so use something else. */
138 %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
139 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
141 %token ATTRIBUTE EXTENSION LABEL
142 %token REALPART IMAGPART
144 /* the reserved words... C++ extensions */
146 %token <ttype> VISSPEC
147 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
148 %token NAMESPACE TYPENAME_KEYWORD USING
149 %token LEFT_RIGHT TEMPLATE
150 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
153 /* Define the operator tokens and their precedences.
154 The value is an integer because, if used, it is the tree code
155 to use in the expression made from the operator. */
157 %left EMPTY /* used to resolve s/r with epsilon */
161 /* Add precedence rules to solve dangling else s/r conflict */
165 %left IDENTIFIER TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
171 %right <code> ASSIGN '='
179 %left <code> EQCOMPARE
180 %left <code> ARITHCOMPARE '<' '>'
181 %left <code> LSHIFT RSHIFT
183 %left <code> '*' '/' '%'
184 %left <code> POINTSAT_STAR DOT_STAR
185 %right <code> UNARY PLUSPLUS MINUSMINUS '~'
187 %left <ttype> PAREN_STAR_PAREN LEFT_RIGHT
188 %left <code> POINTSAT '.' '(' '['
190 %right SCOPE /* C++ extension */
191 %nonassoc NEW DELETE TRY CATCH
195 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
196 %type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
197 %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
198 %type <ttype> reserved_declspecs boolean.literal
199 %type <ttype> reserved_typespecquals
200 %type <ttype> declmods
201 %type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
202 %type <itype> initdecls notype_initdecls initdcl /* C++ modification */
203 %type <ttype> init initlist maybeasm maybe_init defarg defarg1
204 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
205 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
206 %type <ttype> any_word
208 %type <ttype> compstmt implicitly_scoped_stmt
210 %type <ttype> declarator notype_declarator after_type_declarator
211 %type <ttype> direct_notype_declarator direct_after_type_declarator
213 %type <ttype> opt.component_decl_list component_decl_list
214 %type <ttype> component_decl component_decl_1 components notype_components
215 %type <ttype> component_declarator component_declarator0 self_reference
216 %type <ttype> notype_component_declarator notype_component_declarator0
217 %type <ttype> after_type_component_declarator after_type_component_declarator0
218 %type <ttype> enumlist enumerator
219 %type <ttype> absdcl cv_qualifiers
220 %type <ttype> direct_abstract_declarator conversion_declarator
221 %type <ttype> new_declarator direct_new_declarator
222 %type <ttype> xexpr parmlist parms bad_parm
223 %type <ttype> identifiers_or_typenames
224 %type <ttype> fcast_or_absdcl regcast_or_absdcl
225 %type <ttype> expr_or_declarator complex_notype_declarator
226 %type <ttype> notype_unqualified_id unqualified_id qualified_id
227 %type <ttype> overqualified_id notype_qualified_id any_id
228 %type <ttype> complex_direct_notype_declarator functional_cast
229 %type <ttype> complex_parmlist parms_comma
231 %type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
232 %type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
233 %type <ftype> structsp typespecqual_reserved parm named_parm full_parm
236 %token <ttype> TYPENAME_ELLIPSIS PTYPENAME
237 %token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
238 %token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
239 %type <ttype> fn.def1 /* Not really! */ component_constructor_declarator
240 %type <ttype> fn.def2 return_id fn.defpen constructor_declarator
241 %type <itype> ctor_initializer_opt
242 %type <ttype> named_class_head named_class_head_sans_basetype
243 %type <ttype> named_complex_class_head_sans_basetype
244 %type <ttype> unnamed_class_head
245 %type <ttype> class_head base_class_list
246 %type <ttype> base_class_access_list
247 %type <ttype> base_class maybe_base_class_list base_class.1
248 %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
249 %type <ttype> operator_name
250 %type <ttype> object aggr
251 %type <itype> new delete
252 /* %type <ttype> primary_no_id */
253 %type <ttype> nonmomentary_expr maybe_parmlist
254 %type <itype> initdcl0 notype_initdcl0 member_init_list
255 %type <ttype> template_header template_parm_list template_parm
256 %type <ttype> template_type_parm
257 %type <code> template_close_bracket
258 %type <ttype> template_type template_arg_list template_arg
259 %type <ttype> condition xcond paren_cond_or_null
260 %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
261 %type <ttype> complete_type_name notype_identifier
262 %type <ttype> complex_type_name nested_name_specifier_1
263 %type <itype> nomods_initdecls nomods_initdcl0
264 %type <ttype> new_initializer new_placement
265 %type <ttype> using_decl .poplevel
267 /* in order to recognize aggr tags as defining and thus shadowing. */
268 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
269 %type <ttype> named_class_head_sans_basetype_defn
270 %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
272 %type <ttype> self_template_type
277 /* Used in lex.c for parsing pragmas. */
280 /* lex.c and pt.c depend on this being the last token. Define
281 any new tokens before this one! */
282 %token END_OF_SAVED_INPUT
285 /* List of types and structure classes of the current declaration. */
286 static tree current_declspecs = NULL_TREE;
287 /* List of prefix attributes in effect.
288 Prefix attributes are parsed by the reserved_declspecs and declmods
289 rules. They create a list that contains *both* declspecs and attrs. */
290 /* ??? It is not clear yet that all cases where an attribute can now appear in
291 a declspec list have been updated. */
292 static tree prefix_attributes = NULL_TREE;
294 /* When defining an aggregate, this is the most recent one being defined. */
295 static tree current_aggr;
297 /* Tell yyparse how to print a token's value, if yydebug is set. */
299 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
300 extern void yyprint PROTO((FILE *, int, YYSTYPE));
301 extern tree combine_strings PROTO((tree));
309 /* In case there were missing closebraces,
310 get us back to the global binding level. */
311 while (! global_bindings_p ())
317 /* the reason for the strange actions in this rule
318 is so that notype_initdecls when reached via datadef
319 can find a valid list of type and sc specs in $0. */
322 { $<ttype>$ = NULL_TREE; }
324 { $<ttype>$ = NULL_TREE; }
325 | extdefs lang_extdef
326 { $<ttype>$ = NULL_TREE; }
335 { have_extern_spec = 1;
336 used_extern_spec = 0;
337 $<ttype>$ = NULL_TREE; }
340 { have_extern_spec = 0; }
345 { $<itype>$ = pedantic;
355 { if (pending_lang_change) do_pending_lang_change(); }
357 { if (! toplevel_bindings_p () && ! pseudo_global_level_p())
362 fndef eat_saved_input
363 { if (pending_inlines) do_pending_inlines (); }
365 { if (pending_inlines) do_pending_inlines (); }
367 { if (pending_inlines) do_pending_inlines (); }
368 | asm_keyword '(' string ')' ';'
369 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
371 | extern_lang_string '{' extdefs_opt '}'
372 { pop_lang_context (); }
373 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
374 { if (pending_inlines) do_pending_inlines ();
375 pop_lang_context (); }
376 | extern_lang_string .hush_warning datadef .warning_ok
377 { if (pending_inlines) do_pending_inlines ();
378 pop_lang_context (); }
379 | NAMESPACE identifier '{'
380 { push_namespace ($2); }
382 { pop_namespace (); }
384 { push_namespace (NULL_TREE); }
386 { pop_namespace (); }
387 | NAMESPACE identifier '=' any_id ';'
388 { do_namespace_alias ($2, $4); }
390 { do_toplevel_using_decl ($1); }
391 | USING NAMESPACE any_id ';'
393 if (TREE_CODE ($3) == IDENTIFIER_NODE)
395 do_using_directive ($3);
398 { pedantic = $<itype>1; }
404 | USING global_scope qualified_id
406 | USING global_scope unqualified_id
413 | global_scope qualified_id
415 | global_scope unqualified_id
421 { push_lang_context ($1); }
422 | extern_lang_string EXTERN_LANG_STRING
423 { if (current_lang_name != $2)
424 cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
425 pop_lang_context (); push_lang_context ($2); }
430 { begin_template_parm_list (); }
431 template_parm_list '>'
432 { $$ = end_template_parm_list ($4); }
439 { $$ = process_template_parm (NULL_TREE, $1); }
440 | template_parm_list ',' template_parm
441 { $$ = process_template_parm ($1, $3); }
447 $$ = build_tree_list ($1, NULL_TREE);
449 if (TREE_PURPOSE ($$) == signature_type_node)
450 sorry ("signature as template type parameter");
451 else if (TREE_PURPOSE ($$) != class_type_node)
453 pedwarn ("template type parameters must use the keyword `class'");
454 TREE_PURPOSE ($$) = class_type_node;
458 { $$ = build_tree_list ($1, $2); goto ttpa; }
460 { $$ = build_tree_list (class_type_node, NULL_TREE); }
461 | TYPENAME_KEYWORD identifier
462 { $$ = build_tree_list (class_type_node, $2); }
466 /* The following rules introduce a new reduce/reduce
467 conflict on the ',' and '>' input tokens: they are valid
468 prefixes for a `structsp', which means they could match a
469 nameless parameter. See 14.6, paragraph 3.
470 By putting them before the `parm' rule, we get
471 their match before considering them nameless parameter
474 { $$ = build_tree_list (NULL_TREE, $1); }
475 | template_type_parm '=' type_id
476 { $$ = build_tree_list (groktypename ($3.t), $1); }
478 { $$ = build_tree_list (NULL_TREE, $1.t); }
479 | parm '=' expr_no_commas %prec ARITHCOMPARE
480 { $$ = build_tree_list ($3, $1.t); }
486 { end_template_decl (); }
489 { end_template_decl (); }
495 | declmods notype_initdecls ';'
497 | typed_declspecs initdecls ';'
499 note_list_got_semicolon ($1.t);
502 { pedwarn ("empty declaration"); }
503 | explicit_instantiation ';'
504 | typed_declspecs ';'
507 split_specs_attrs ($1.t, &t, &attrs);
509 note_list_got_semicolon ($1.t);
516 ctor_initializer_opt:
535 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
536 { finish_function (lineno, (int)$3, 0); }
537 | fn.def1 maybe_return_init function_try_block
539 | fn.def1 maybe_return_init error
543 constructor_declarator:
544 nested_name_specifier SELFNAME '('
546 $$ = build_parse_node (SCOPE_REF, $1, $2);
547 if ($1 != current_class_type)
549 push_nested_class ($1, 3);
550 TREE_COMPLEXITY ($$) = current_class_depth;
553 parmlist ')' cv_qualifiers exception_specification_opt
554 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
555 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
557 $$ = build_parse_node (SCOPE_REF, $1, $2);
558 if ($1 != current_class_type)
560 push_nested_class ($1, 3);
561 TREE_COMPLEXITY ($$) = current_class_depth;
563 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
565 | global_scope nested_name_specifier SELFNAME '('
567 $$ = build_parse_node (SCOPE_REF, $2, $3);
568 if ($2 != current_class_type)
570 push_nested_class ($2, 3);
571 TREE_COMPLEXITY ($$) = current_class_depth;
574 parmlist ')' cv_qualifiers exception_specification_opt
575 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
576 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
578 $$ = build_parse_node (SCOPE_REF, $2, $3);
579 if ($2 != current_class_type)
581 push_nested_class ($2, 3);
582 TREE_COMPLEXITY ($$) = current_class_depth;
584 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
586 | nested_name_specifier self_template_type '('
588 $$ = build_parse_node (SCOPE_REF, $1, $2);
589 if ($1 != current_class_type)
591 push_nested_class ($1, 3);
592 TREE_COMPLEXITY ($$) = current_class_depth;
595 parmlist ')' cv_qualifiers exception_specification_opt
596 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
597 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
599 $$ = build_parse_node (SCOPE_REF, $1, $2);
600 if ($1 != current_class_type)
602 push_nested_class ($1, 3);
603 TREE_COMPLEXITY ($$) = current_class_depth;
605 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
607 | global_scope nested_name_specifier self_template_type '('
609 $$ = build_parse_node (SCOPE_REF, $2, $3);
610 if ($2 != current_class_type)
612 push_nested_class ($2, 3);
613 TREE_COMPLEXITY ($$) = current_class_depth;
616 parmlist ')' cv_qualifiers exception_specification_opt
617 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
618 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
620 $$ = build_parse_node (SCOPE_REF, $2, $3);
621 if ($2 != current_class_type)
623 push_nested_class ($2, 3);
624 TREE_COMPLEXITY ($$) = current_class_depth;
626 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
631 typed_declspecs declarator
633 split_specs_attrs ($1.t, &specs, &attrs);
634 if (! start_function (specs, $2, attrs, 0))
636 reinit_parse_for_function ();
638 | declmods notype_declarator
640 split_specs_attrs ($1, &specs, &attrs);
641 if (! start_function (specs, $2, attrs, 0))
643 reinit_parse_for_function ();
646 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
648 reinit_parse_for_function ();
650 | declmods constructor_declarator
652 split_specs_attrs ($1, &specs, &attrs);
653 if (! start_function (specs, $2, attrs, 0))
655 reinit_parse_for_function ();
657 | constructor_declarator
658 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
660 reinit_parse_for_function ();
664 component_constructor_declarator:
665 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
666 { $$ = make_call_declarator ($1, $3, $5, $6); }
667 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
668 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
669 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
670 { $$ = make_call_declarator ($1, $3, $5, $6); }
671 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
672 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
675 /* more C++ complexity. See component_decl for a comment on the
676 reduce/reduce conflict introduced by these rules. */
678 declmods component_constructor_declarator
679 { tree specs = strip_attrs ($1);
680 $$ = start_method (specs, $2);
684 if (yychar == YYEMPTY)
686 reinit_parse_for_method (yychar, $$); }
687 | component_constructor_declarator
688 { $$ = start_method (NULL_TREE, $1); goto rest_of_mdef; }
689 | typed_declspecs declarator
690 { tree specs = strip_attrs ($1.t);
691 $$ = start_method (specs, $2); goto rest_of_mdef; }
692 | declmods notype_declarator
693 { tree specs = strip_attrs ($1);
694 $$ = start_method (specs, $2); goto rest_of_mdef; }
696 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
697 | declmods constructor_declarator
698 { tree specs = strip_attrs ($1);
699 $$ = start_method (specs, $2); goto rest_of_mdef; }
700 | constructor_declarator
701 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
702 | template_header fn.def2
704 end_template_decl ();
705 if ($2 && DECL_TEMPLATE_INFO ($2))
707 $$ = DECL_TI_TEMPLATE ($2);
708 check_member_template ($$);
714 cp_error("invalid member template declaration");
723 if (! current_function_parms_stored)
731 { store_return_init ($<ttype>$, $2); }
732 | return_id '(' nonnull_exprlist ')'
733 { store_return_init ($<ttype>$, $3); }
734 | return_id LEFT_RIGHT
735 { store_return_init ($<ttype>$, NULL_TREE); }
739 ':' .set_base_init member_init_list
742 error ("no base initializers given following ':'");
744 /* Always keep the BLOCK node associated with the outermost
745 pair of curley braces of a function. These are needed
746 for correct operation of dwarfout.c. */
754 if (! current_function_parms_stored)
757 if (DECL_CONSTRUCTOR_P (current_function_decl))
759 /* Make a contour for the initializer list. */
762 expand_start_bindings (0);
764 else if (current_class_type == NULL_TREE)
765 error ("base initializers not allowed for non-member functions");
766 else if (! DECL_CONSTRUCTOR_P (current_function_decl))
767 error ("only constructors take base initializers");
776 | member_init_list ',' member_init
777 | member_init_list error
781 '(' nonnull_exprlist ')'
783 if (current_class_name)
784 pedwarn ("anachronistic old style base class initializer");
785 expand_member_init (current_class_ref, NULL_TREE, $2);
789 if (current_class_name)
790 pedwarn ("anachronistic old style base class initializer");
791 expand_member_init (current_class_ref, NULL_TREE, void_type_node);
793 | notype_identifier '(' nonnull_exprlist ')'
794 { expand_member_init (current_class_ref, $1, $3); }
795 | notype_identifier LEFT_RIGHT
796 { expand_member_init (current_class_ref, $1, void_type_node); }
797 | complete_type_name '(' nonnull_exprlist ')'
798 { expand_member_init (current_class_ref, $1, $3); }
799 | complete_type_name LEFT_RIGHT
800 { expand_member_init (current_class_ref, $1, void_type_node); }
802 | notype_qualified_id '(' nonnull_exprlist ')'
804 do_member_init (OP0 ($1), OP1 ($1), $3);
806 | notype_qualified_id LEFT_RIGHT
808 do_member_init (OP0 ($1), OP1 ($1), void_type_node);
832 explicit_instantiation:
833 TEMPLATE typespec ';'
834 { do_type_instantiation ($2.t, NULL_TREE);
836 | TEMPLATE typed_declspecs declarator
837 { tree specs = strip_attrs ($2.t);
838 do_decl_instantiation (specs, $3, NULL_TREE); }
839 | TEMPLATE notype_declarator
840 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
841 | TEMPLATE constructor_declarator
842 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
843 | SCSPEC TEMPLATE typespec ';'
844 { do_type_instantiation ($3.t, $1);
846 | SCSPEC TEMPLATE typed_declspecs declarator
847 { tree specs = strip_attrs ($3.t);
848 do_decl_instantiation (specs, $4, $1); }
849 | SCSPEC TEMPLATE notype_declarator
850 { do_decl_instantiation (NULL_TREE, $3, $1); }
851 | SCSPEC TEMPLATE constructor_declarator
852 { do_decl_instantiation (NULL_TREE, $3, $1); }
855 /* The TYPENAME expansions are to deal with use of a template class name as
856 a template within the class itself, where the template decl is hidden by
857 a type decl. Got all that? */
860 PTYPENAME '<' template_arg_list template_close_bracket
862 $$ = lookup_template_class ($1, $3, NULL_TREE);
863 if ($$ != error_mark_node)
864 $$ = TYPE_STUB_DECL ($$);
866 | PTYPENAME '<' template_close_bracket
868 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
869 if ($$ != error_mark_node)
870 $$ = TYPE_STUB_DECL ($$);
872 | TYPENAME '<' template_arg_list template_close_bracket
874 $$ = lookup_template_class ($1, $3, NULL_TREE);
875 if ($$ != error_mark_node)
876 $$ = TYPE_STUB_DECL ($$);
878 | TYPENAME '<' template_close_bracket
880 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
881 if ($$ != error_mark_node)
882 $$ = TYPE_STUB_DECL ($$);
888 SELFNAME '<' template_arg_list template_close_bracket
890 $$ = lookup_template_class ($1, $3, NULL_TREE);
891 if ($$ != error_mark_node)
892 $$ = TYPE_STUB_DECL ($$);
894 | SELFNAME '<' template_close_bracket
896 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
897 if ($$ != error_mark_node)
898 $$ = TYPE_STUB_DECL ($$);
902 template_close_bracket:
906 /* Handle `Class<Class<Type>>' without space in the `>>' */
907 pedwarn ("`>>' should be `> >' in template class name");
914 { $$ = build_tree_list (NULL_TREE, $$); }
915 | template_arg_list ',' template_arg
916 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
921 { $$ = groktypename ($1.t); }
922 | expr_no_commas %prec ARITHCOMPARE
927 { $$ = NEGATE_EXPR; }
929 { $$ = CONVERT_EXPR; }
931 { $$ = PREINCREMENT_EXPR; }
933 { $$ = PREDECREMENT_EXPR; }
935 { $$ = TRUTH_NOT_EXPR; }
940 { $$ = build_x_compound_expr ($$); }
946 { error ("ANSI C++ forbids an empty condition for `%s'",
948 $$ = integer_zero_node; }
950 { $$ = condition_conversion ($2); }
955 { error ("ANSI C++ forbids an empty condition for `%s'",
957 $$ = integer_zero_node; }
959 { $$ = condition_conversion ($2); }
966 { $$ = condition_conversion ($$); }
972 type_specifier_seq declarator maybeasm maybe_attribute '='
975 for (d = getdecls (); d; d = TREE_CHAIN (d))
976 if (TREE_CODE (d) == TYPE_DECL) {
977 tree s = TREE_TYPE (d);
978 if (TREE_CODE (s) == RECORD_TYPE)
979 cp_error ("definition of class `%T' in condition", s);
980 else if (TREE_CODE (s) == ENUMERAL_TYPE)
981 cp_error ("definition of enum `%T' in condition", s);
984 current_declspecs = $1.t;
985 $<itype>5 = suspend_momentary ();
986 $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1);
987 cplus_decl_attributes ($<ttype>$, $4,
988 /*prefix_attributes*/ NULL_TREE);
992 cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
993 resume_momentary ($<itype>5);
995 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
996 cp_error ("definition of array `%#D' in condition", $$);
1003 | maybe_label_decls stmts '}'
1004 | maybe_label_decls stmts error '}'
1005 | maybe_label_decls error '}'
1008 already_scoped_stmt:
1011 if (processing_template_decl)
1013 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
1014 COMPOUND_STMT_NO_SCOPE ($<ttype>$) = 1;
1015 add_tree ($<ttype>$);
1020 if (processing_template_decl)
1022 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
1023 TREE_CHAIN ($<ttype>2) = NULL_TREE;
1024 last_tree = $<ttype>2;
1032 nontrivial_exprlist:
1033 expr_no_commas ',' expr_no_commas
1034 { $$ = tree_cons (NULL_TREE, $$,
1035 build_tree_list (NULL_TREE, $3)); }
1036 | expr_no_commas ',' error
1037 { $$ = tree_cons (NULL_TREE, $$,
1038 build_tree_list (NULL_TREE, error_mark_node)); }
1039 | nontrivial_exprlist ',' expr_no_commas
1040 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1041 | nontrivial_exprlist ',' error
1042 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1047 { $$ = build_tree_list (NULL_TREE, $$); }
1048 | nontrivial_exprlist
1054 /* __extension__ turns off -pedantic for following primary. */
1055 | extension cast_expr %prec UNARY
1057 pedantic = $<itype>1; }
1058 | '*' cast_expr %prec UNARY
1059 { $$ = build_x_indirect_ref ($2, "unary *"); }
1060 | '&' cast_expr %prec UNARY
1061 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1063 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1064 | unop cast_expr %prec UNARY
1065 { $$ = build_x_unary_op ($1, $2);
1066 if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
1067 TREE_NEGATED_INT ($$) = 1;
1068 overflow_warning ($$);
1070 /* Refer to the address of a label as a pointer. */
1072 { tree label = lookup_label ($2);
1073 if (label == NULL_TREE)
1074 $$ = null_pointer_node;
1077 TREE_USED (label) = 1;
1078 $$ = build1 (ADDR_EXPR, ptr_type_node, label);
1079 TREE_CONSTANT ($$) = 1;
1082 | SIZEOF unary_expr %prec UNARY
1083 { $$ = expr_sizeof ($2); }
1084 | SIZEOF '(' type_id ')' %prec HYPERUNARY
1085 { $$ = c_sizeof (groktypename ($3.t)); }
1086 | ALIGNOF unary_expr %prec UNARY
1087 { $$ = grok_alignof ($2); }
1088 | ALIGNOF '(' type_id ')' %prec HYPERUNARY
1089 { $$ = c_alignof (groktypename ($3.t));
1090 check_for_new_type ("alignof", $3); }
1092 /* The %prec EMPTY's here are required by the = init initializer
1093 syntax extension; see below. */
1094 | new new_type_id %prec EMPTY
1095 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1096 check_for_new_type ("new", $2); }
1097 | new new_type_id new_initializer
1098 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1099 check_for_new_type ("new", $2); }
1100 | new new_placement new_type_id %prec EMPTY
1101 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1102 check_for_new_type ("new", $3); }
1103 | new new_placement new_type_id new_initializer
1104 { $$ = build_new ($2, $3.t, $4, $1);
1105 check_for_new_type ("new", $3); }
1106 | new '(' type_id ')' %prec EMPTY
1107 { $$ = build_new (NULL_TREE, groktypename($3.t),
1109 check_for_new_type ("new", $3); }
1110 | new '(' type_id ')' new_initializer
1111 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1112 check_for_new_type ("new", $3); }
1113 | new new_placement '(' type_id ')' %prec EMPTY
1114 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1115 check_for_new_type ("new", $4); }
1116 | new new_placement '(' type_id ')' new_initializer
1117 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1118 check_for_new_type ("new", $4); }
1120 | delete cast_expr %prec UNARY
1121 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1122 | delete '[' ']' cast_expr %prec UNARY
1123 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1124 if (yychar == YYEMPTY)
1126 | delete '[' expr ']' cast_expr %prec UNARY
1127 { $$ = delete_sanity ($5, $3, 2, $1);
1128 if (yychar == YYEMPTY)
1130 | REALPART cast_expr %prec UNARY
1131 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1132 | IMAGPART cast_expr %prec UNARY
1133 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1137 '(' nonnull_exprlist ')'
1139 | '{' nonnull_exprlist '}'
1142 pedwarn ("old style placement syntax, use () instead");
1147 '(' nonnull_exprlist ')'
1153 cp_error ("`%T' is not a valid expression", $2.t);
1154 $$ = error_mark_node;
1156 /* GNU extension so people can use initializer lists. Note that
1157 this alters the meaning of `new int = 1', which was previously
1158 syntactically valid but semantically invalid. */
1162 pedwarn ("ANSI C++ forbids initialization of new expression with `='");
1167 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1169 '(' type_id ')' %prec EMPTY
1170 { $2.t = tree_cons (NULL_TREE, $2.t, void_list_node);
1171 TREE_PARMLIST ($2.t) = 1;
1172 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1173 check_for_new_type ("cast", $2); }
1174 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1175 { $3.t = tree_cons (NULL_TREE, $3.t, void_list_node);
1176 TREE_PARMLIST ($3.t) = 1;
1177 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1178 check_for_new_type ("cast", $3); }
1183 | regcast_or_absdcl unary_expr %prec UNARY
1184 { $$ = reparse_absdcl_as_casts ($$, $2); }
1185 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1187 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1190 pedwarn ("ANSI C++ forbids constructor-expressions");
1191 /* Indicate that this was a GNU C constructor expression. */
1192 TREE_HAS_CONSTRUCTOR (init) = 1;
1194 $$ = reparse_absdcl_as_casts ($$, init);
1200 /* Handle general members. */
1201 | expr_no_commas POINTSAT_STAR expr_no_commas
1202 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1203 | expr_no_commas DOT_STAR expr_no_commas
1204 { $$ = build_m_component_ref ($$, $3); }
1205 | expr_no_commas '+' expr_no_commas
1206 { $$ = build_x_binary_op ($2, $$, $3); }
1207 | expr_no_commas '-' expr_no_commas
1208 { $$ = build_x_binary_op ($2, $$, $3); }
1209 | expr_no_commas '*' expr_no_commas
1210 { $$ = build_x_binary_op ($2, $$, $3); }
1211 | expr_no_commas '/' expr_no_commas
1212 { $$ = build_x_binary_op ($2, $$, $3); }
1213 | expr_no_commas '%' expr_no_commas
1214 { $$ = build_x_binary_op ($2, $$, $3); }
1215 | expr_no_commas LSHIFT expr_no_commas
1216 { $$ = build_x_binary_op ($2, $$, $3); }
1217 | expr_no_commas RSHIFT expr_no_commas
1218 { $$ = build_x_binary_op ($2, $$, $3); }
1219 | expr_no_commas ARITHCOMPARE expr_no_commas
1220 { $$ = build_x_binary_op ($2, $$, $3); }
1221 | expr_no_commas '<' expr_no_commas
1222 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1223 | expr_no_commas '>' expr_no_commas
1224 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1225 | expr_no_commas EQCOMPARE expr_no_commas
1226 { $$ = build_x_binary_op ($2, $$, $3); }
1227 | expr_no_commas MIN_MAX expr_no_commas
1228 { $$ = build_x_binary_op ($2, $$, $3); }
1229 | expr_no_commas '&' expr_no_commas
1230 { $$ = build_x_binary_op ($2, $$, $3); }
1231 | expr_no_commas '|' expr_no_commas
1232 { $$ = build_x_binary_op ($2, $$, $3); }
1233 | expr_no_commas '^' expr_no_commas
1234 { $$ = build_x_binary_op ($2, $$, $3); }
1235 | expr_no_commas ANDAND expr_no_commas
1236 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1237 | expr_no_commas OROR expr_no_commas
1238 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1239 | expr_no_commas '?' xexpr ':' expr_no_commas
1240 { $$ = build_x_conditional_expr ($$, $3, $5); }
1241 | expr_no_commas '=' expr_no_commas
1242 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1243 if ($$ != error_mark_node)
1244 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1245 | expr_no_commas ASSIGN expr_no_commas
1246 { $$ = build_x_modify_expr ($$, $2, $3); }
1248 { $$ = build_throw (NULL_TREE); }
1249 | THROW expr_no_commas
1250 { $$ = build_throw ($2); }
1251 /* These extensions are not defined. The second arg to build_m_component_ref
1252 is old, build_m_component_ref now does an implicit
1253 build_indirect_ref (x, NULL_PTR) on the second argument.
1254 | object '&' expr_no_commas %prec UNARY
1255 { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
1256 | object unop expr_no_commas %prec UNARY
1257 { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
1258 | object '(' type_id ')' expr_no_commas %prec UNARY
1259 { tree type = groktypename ($3.t);
1260 $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
1261 | object primary_no_id %prec UNARY
1262 { $$ = build_m_component_ref ($$, $2); }
1266 notype_unqualified_id:
1267 '~' see_typename identifier
1268 { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
1272 | NSNAME %prec EMPTY
1276 notype_unqualified_id
1282 notype_unqualified_id
1283 | '*' expr_or_declarator %prec UNARY
1284 { $$ = build_parse_node (INDIRECT_REF, $2); }
1285 | '&' expr_or_declarator %prec UNARY
1286 { $$ = build_parse_node (ADDR_EXPR, $2); }
1287 | '(' expr_or_declarator ')'
1291 direct_notype_declarator:
1292 complex_direct_notype_declarator
1293 | notype_unqualified_id
1294 | '(' expr_or_declarator ')'
1295 { $$ = finish_decl_parsing ($2); }
1299 notype_unqualified_id
1301 if (TREE_CODE ($$) == BIT_NOT_EXPR)
1302 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
1304 $$ = do_identifier ($$, 1);
1310 if (processing_template_decl)
1311 push_obstacks (&permanent_obstack, &permanent_obstack);
1312 $$ = combine_strings ($$);
1313 if (processing_template_decl)
1319 class = TREE_CODE_CLASS (TREE_CODE ($$));
1320 if (class == 'e' || class == '1'
1321 || class == '2' || class == '<')
1322 /* This inhibits warnings in truthvalue_conversion. */
1323 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1324 | '(' expr_or_declarator ')'
1326 $$ = reparse_decl_as_expr (NULL_TREE, $2);
1327 class = TREE_CODE_CLASS (TREE_CODE ($$));
1328 if (class == 'e' || class == '1'
1329 || class == '2' || class == '<')
1330 /* This inhibits warnings in truthvalue_conversion. */
1331 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1333 { $$ = error_mark_node; }
1335 { if (current_function_decl == 0)
1337 error ("braced-group within expression allowed only inside a function");
1341 $<ttype>$ = expand_start_stmt_expr (); }
1345 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1346 rtl_exp = expand_end_stmt_expr ($<ttype>2);
1347 /* The statements have side effects, so the group does. */
1348 TREE_SIDE_EFFECTS (rtl_exp) = 1;
1350 if (TREE_CODE ($3) == BLOCK)
1352 /* Make a BIND_EXPR for the BLOCK already made. */
1353 $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
1354 NULL_TREE, rtl_exp, $3);
1355 /* Remove the block from the tree at this point.
1356 It gets put back at the proper place
1357 when the BIND_EXPR is expanded. */
1363 | primary '(' nonnull_exprlist ')'
1365 $$ = build_x_function_call ($1, $3, current_class_ref);
1366 if (TREE_CODE ($$) == CALL_EXPR
1367 && TREE_TYPE ($$) != void_type_node)
1368 $$ = require_complete_type ($$);
1370 | primary LEFT_RIGHT
1372 $$ = build_x_function_call ($$, NULL_TREE, current_class_ref);
1373 if (TREE_CODE ($$) == CALL_EXPR
1374 && TREE_TYPE ($$) != void_type_node)
1375 $$ = require_complete_type ($$);
1377 | primary '[' expr ']'
1378 { $$ = grok_array_decl ($$, $3); }
1380 { /* If we get an OFFSET_REF, turn it into what it really
1381 means (e.g., a COMPONENT_REF). This way if we've got,
1382 say, a reference to a static member that's being operated
1383 on, we don't end up trying to find a member operator for
1384 the class it's in. */
1385 if (TREE_CODE ($$) == OFFSET_REF)
1386 $$ = resolve_offset_ref ($$);
1387 $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1388 | primary MINUSMINUS
1389 { if (TREE_CODE ($$) == OFFSET_REF)
1390 $$ = resolve_offset_ref ($$);
1391 $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1392 /* C++ extensions */
1394 { if (current_class_ptr)
1396 #ifdef WARNING_ABOUT_CCD
1397 TREE_USED (current_class_ptr) = 1;
1399 $$ = current_class_ptr;
1401 else if (current_function_decl
1402 && DECL_STATIC_FUNCTION_P (current_function_decl))
1404 error ("`this' is unavailable for static member functions");
1405 $$ = error_mark_node;
1409 if (current_function_decl)
1410 error ("invalid use of `this' in non-member function");
1412 error ("invalid use of `this' at top level");
1413 $$ = error_mark_node;
1416 | CV_QUALIFIER '(' nonnull_exprlist ')'
1421 /* This is a C cast in C++'s `functional' notation. */
1422 if ($3 == error_mark_node)
1424 $$ = error_mark_node;
1428 if ($3 == NULL_TREE)
1430 error ("cannot cast null list to type `%s'",
1431 IDENTIFIER_POINTER (TYPE_NAME (id)));
1432 $$ = error_mark_node;
1437 /* type is not set! (mrs) */
1438 if (type == error_mark_node)
1439 $$ = error_mark_node;
1443 if (id == ridpointers[(int) RID_CONST])
1444 type = build_type_variant (integer_type_node, 1, 0);
1445 else if (id == ridpointers[(int) RID_VOLATILE])
1446 type = build_type_variant (integer_type_node, 0, 1);
1448 /* should not be able to get here (mrs) */
1449 else if (id == ridpointers[(int) RID_FRIEND])
1451 error ("cannot cast expression to `friend' type");
1452 $$ = error_mark_node;
1456 else my_friendly_abort (79);
1457 $$ = build_c_cast (type, build_compound_expr ($3));
1461 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1462 { tree type = groktypename ($3.t);
1463 check_for_new_type ("dynamic_cast", $3);
1464 $$ = build_dynamic_cast (type, $6); }
1465 | STATIC_CAST '<' type_id '>' '(' expr ')'
1466 { tree type = groktypename ($3.t);
1467 check_for_new_type ("static_cast", $3);
1468 $$ = build_static_cast (type, $6); }
1469 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1470 { tree type = groktypename ($3.t);
1471 check_for_new_type ("reinterpret_cast", $3);
1472 $$ = build_reinterpret_cast (type, $6); }
1473 | CONST_CAST '<' type_id '>' '(' expr ')'
1474 { tree type = groktypename ($3.t);
1475 check_for_new_type ("const_cast", $3);
1476 $$ = build_const_cast (type, $6); }
1477 | TYPEID '(' expr ')'
1478 { $$ = build_x_typeid ($3); }
1479 | TYPEID '(' type_id ')'
1480 { tree type = groktypename ($3.t);
1481 check_for_new_type ("typeid", $3);
1482 $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
1483 | global_scope IDENTIFIER
1484 { $$ = do_scoped_id ($2, 1); }
1485 | global_scope operator_name
1487 got_scope = NULL_TREE;
1488 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1489 $$ = do_scoped_id ($2, 1);
1493 | overqualified_id %prec HYPERUNARY
1494 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1495 | overqualified_id '(' nonnull_exprlist ')'
1496 { if (processing_template_decl)
1497 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, NULL_TREE);
1499 $$ = build_member_call (OP0 ($$), OP1 ($$), $3); }
1500 | overqualified_id LEFT_RIGHT
1501 { if (processing_template_decl)
1502 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1),
1503 NULL_TREE, NULL_TREE);
1505 $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); }
1506 | object unqualified_id %prec UNARY
1507 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1508 | object overqualified_id %prec UNARY
1509 { if (processing_template_decl)
1510 $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
1512 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1513 | object unqualified_id '(' nonnull_exprlist ')'
1516 /* This is a future direction of this code, but because
1517 build_x_function_call cannot always undo what is done
1518 in build_component_ref entirely yet, we cannot do this. */
1519 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, current_class_ref);
1520 if (TREE_CODE ($$) == CALL_EXPR
1521 && TREE_TYPE ($$) != void_type_node)
1522 $$ = require_complete_type ($$);
1524 $$ = build_method_call ($$, $2, $4, NULL_TREE,
1528 | object unqualified_id LEFT_RIGHT
1531 /* This is a future direction of this code, but because
1532 build_x_function_call cannot always undo what is done
1533 in build_component_ref entirely yet, we cannot do this. */
1534 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, current_class_ref);
1535 if (TREE_CODE ($$) == CALL_EXPR
1536 && TREE_TYPE ($$) != void_type_node)
1537 $$ = require_complete_type ($$);
1539 $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
1543 | object overqualified_id '(' nonnull_exprlist ')'
1545 if (IS_SIGNATURE (OP0 ($2)))
1547 warning ("signature name in scope resolution ignored");
1548 $$ = build_method_call ($$, OP1 ($2), $4, NULL_TREE,
1552 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
1554 | object overqualified_id LEFT_RIGHT
1556 if (IS_SIGNATURE (OP0 ($2)))
1558 warning ("signature name in scope resolution ignored");
1559 $$ = build_method_call ($$, OP1 ($2), NULL_TREE, NULL_TREE,
1563 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), NULL_TREE);
1565 /* p->int::~int() is valid -- 12.4 */
1566 | object '~' TYPESPEC LEFT_RIGHT
1568 if (IDENTIFIER_GLOBAL_VALUE ($3)
1569 && (TREE_CODE (TREE_TYPE ($1))
1570 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
1571 cp_error ("`%E' is not of type `%T'", $1, $3);
1572 $$ = cp_convert (void_type_node, $1);
1574 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1577 cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
1578 if (TREE_CODE (TREE_TYPE ($1))
1579 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
1580 cp_error ("`%E' is not of type `%T'", $1, $2);
1581 $$ = cp_convert (void_type_node, $1);
1585 $$ = error_mark_node;
1589 /* Not needed for now.
1595 { $$ = error_mark_node; }
1597 { if (current_function_decl == 0)
1599 error ("braced-group within expression allowed only inside a function");
1602 $<ttype>$ = expand_start_stmt_expr (); }
1605 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1606 $$ = expand_end_stmt_expr ($<ttype>2); }
1607 | primary_no_id '(' nonnull_exprlist ')'
1608 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1609 | primary_no_id LEFT_RIGHT
1610 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1611 | primary_no_id '[' expr ']'
1613 | primary_no_id PLUSPLUS
1614 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1615 | primary_no_id MINUSMINUS
1616 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1618 { goto do_scoped_id; }
1619 | SCOPE operator_name
1620 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1622 goto do_scoped_operator;
1631 { got_scope = NULL_TREE; $$ = 1; }
1637 | global_scope delete
1638 { got_scope = NULL_TREE; $$ = 1; }
1643 { $$ = boolean_true_node; }
1645 { $$ = boolean_false_node; }
1648 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1652 { $$ = chainon ($$, $2); }
1658 if (! current_function_parms_stored)
1659 store_parm_decls ();
1661 /* Always keep the BLOCK node associated with the outermost
1662 pair of curley braces of a function. These are needed
1663 for correct operation of dwarfout.c. */
1670 { got_object = TREE_TYPE ($$); }
1673 $$ = build_x_arrow ($$);
1674 got_object = TREE_TYPE ($$);
1679 typespec initdecls ';'
1681 resume_momentary ($2);
1682 if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1683 note_got_semicolon ($1.t);
1685 | typed_declspecs initdecls ';'
1687 resume_momentary ($2);
1688 note_list_got_semicolon ($1.t);
1690 | declmods notype_initdecls ';'
1691 { resume_momentary ($2); }
1692 | typed_declspecs ';'
1695 note_list_got_semicolon ($1.t);
1698 { warning ("empty declaration"); }
1700 { pedantic = $<itype>1; }
1703 /* Any kind of declarator (thus, all declarators allowed
1704 after an explicit typespec). */
1707 after_type_declarator %prec EMPTY
1708 | notype_declarator %prec EMPTY
1711 /* This is necessary to postpone reduction of `int()()()()'. */
1713 LEFT_RIGHT %prec EMPTY
1714 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1715 NULL_TREE, NULL_TREE); }
1716 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1717 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1721 /* ANSI type-id (8.1) */
1723 typed_typespecs absdcl
1724 { $$.t = build_decl_list ($1.t, $2);
1725 $$.new_type_flag = $1.new_type_flag; }
1726 | nonempty_cv_qualifiers absdcl
1727 { $$.t = build_decl_list ($1.t, $2);
1728 $$.new_type_flag = $1.new_type_flag; }
1730 { $$.t = build_decl_list (get_decl_list ($1.t), $2);
1731 $$.new_type_flag = $1.new_type_flag; }
1732 | typed_typespecs %prec EMPTY
1733 { $$.t = build_decl_list ($1.t, NULL_TREE);
1734 $$.new_type_flag = $1.new_type_flag; }
1735 | nonempty_cv_qualifiers %prec EMPTY
1736 { $$.t = build_decl_list ($1.t, NULL_TREE);
1737 $$.new_type_flag = $1.new_type_flag; }
1740 /* Declspecs which contain at least one type specifier or typedef name.
1741 (Just `const' or `volatile' is not enough.)
1742 A typedef'd name following these is taken as a name to be declared.
1743 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1746 typed_typespecs %prec EMPTY
1752 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1);
1753 $$.new_type_flag = $2.new_type_flag; }
1754 | typespec reserved_declspecs %prec HYPERUNARY
1755 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1756 $$.new_type_flag = $1.new_type_flag; }
1757 | typespec reserved_typespecquals reserved_declspecs
1758 { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1759 $$.new_type_flag = $1.new_type_flag; }
1760 | declmods typespec reserved_declspecs
1761 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1762 $$.new_type_flag = $2.new_type_flag; }
1763 | declmods typespec reserved_typespecquals
1764 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1765 $$.new_type_flag = $2.new_type_flag; }
1766 | declmods typespec reserved_typespecquals reserved_declspecs
1767 { $$.t = decl_tree_cons (NULL_TREE, $2.t,
1768 chainon ($3, chainon ($4, $1)));
1769 $$.new_type_flag = $2.new_type_flag; }
1774 { if (extra_warnings)
1775 warning ("`%s' is not at beginning of declaration",
1776 IDENTIFIER_POINTER ($$));
1777 $$ = build_decl_list (NULL_TREE, $$); }
1778 | reserved_declspecs typespecqual_reserved
1779 { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
1780 | reserved_declspecs SCSPEC
1781 { if (extra_warnings)
1782 warning ("`%s' is not at beginning of declaration",
1783 IDENTIFIER_POINTER ($2));
1784 $$ = decl_tree_cons (NULL_TREE, $2, $$); }
1785 | reserved_declspecs attributes
1786 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1788 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1791 /* List of just storage classes and type modifiers.
1792 A declaration can start with just this, but then it cannot be used
1793 to redeclare a typedef-name.
1794 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1797 nonempty_cv_qualifiers %prec EMPTY
1798 { $$ = $1.t; TREE_STATIC ($$) = 1; }
1800 { $$ = IDENTIFIER_AS_LIST ($$); }
1801 | declmods CV_QUALIFIER
1802 { $$ = decl_tree_cons (NULL_TREE, $2, $$);
1803 TREE_STATIC ($$) = 1; }
1805 { if (extra_warnings && TREE_STATIC ($$))
1806 warning ("`%s' is not at beginning of declaration",
1807 IDENTIFIER_POINTER ($2));
1808 $$ = decl_tree_cons (NULL_TREE, $2, $$);
1809 TREE_STATIC ($$) = TREE_STATIC ($1); }
1810 | declmods attributes
1811 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1813 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1816 /* Used instead of declspecs where storage classes are not allowed
1817 (that is, for typenames and structure components).
1819 C++ can takes storage classes for structure components.
1820 Don't accept a typedef-name if anything but a modifier precedes it. */
1823 typespec %prec EMPTY
1824 { $$.t = get_decl_list ($1.t);
1825 $$.new_type_flag = $1.new_type_flag; }
1826 | nonempty_cv_qualifiers typespec
1827 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
1828 $$.new_type_flag = $2.new_type_flag; }
1829 | typespec reserved_typespecquals
1830 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1831 $$.new_type_flag = $1.new_type_flag; }
1832 | nonempty_cv_qualifiers typespec reserved_typespecquals
1833 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1834 $$.new_type_flag = $1.new_type_flag; }
1837 reserved_typespecquals:
1838 typespecqual_reserved
1839 { $$ = build_decl_list (NULL_TREE, $1.t); }
1840 | reserved_typespecquals typespecqual_reserved
1841 { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
1844 /* A typespec (but not a type qualifier).
1845 Once we have seen one of these in a declaration,
1846 if a typedef name appears then it is being redeclared. */
1850 | TYPESPEC %prec EMPTY
1851 { $$.t = $1; $$.new_type_flag = 0; }
1852 | complete_type_name
1853 { $$.t = $1; $$.new_type_flag = 0; }
1854 | TYPEOF '(' expr ')'
1855 { $$.t = TREE_TYPE ($3);
1856 $$.new_type_flag = 0; }
1857 | TYPEOF '(' type_id ')'
1858 { $$.t = groktypename ($3.t);
1859 $$.new_type_flag = 0; }
1860 | SIGOF '(' expr ')'
1861 { tree type = TREE_TYPE ($3);
1863 $$.new_type_flag = 0;
1864 if (IS_AGGR_TYPE (type))
1866 sorry ("sigof type specifier");
1871 error ("`sigof' applied to non-aggregate expression");
1872 $$.t = error_mark_node;
1875 | SIGOF '(' type_id ')'
1876 { tree type = groktypename ($3.t);
1878 $$.new_type_flag = 0;
1879 if (IS_AGGR_TYPE (type))
1881 sorry ("sigof type specifier");
1886 error("`sigof' applied to non-aggregate type");
1887 $$.t = error_mark_node;
1892 /* A typespec that is a reserved word, or a type qualifier. */
1894 typespecqual_reserved:
1896 { $$.t = $1; $$.new_type_flag = 0; }
1898 { $$.t = $1; $$.new_type_flag = 0; }
1904 | initdecls ',' initdcl
1909 | notype_initdecls ',' initdcl
1914 | nomods_initdecls ',' initdcl
1920 | asm_keyword '(' string ')'
1921 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
1925 declarator maybeasm maybe_attribute '='
1926 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1927 &prefix_attributes);
1928 if (current_declspecs
1929 && TREE_CODE (current_declspecs) != TREE_LIST)
1930 current_declspecs = get_decl_list (current_declspecs);
1931 if (have_extern_spec && !used_extern_spec)
1933 current_declspecs = decl_tree_cons
1934 (NULL_TREE, get_identifier ("extern"),
1936 used_extern_spec = 1;
1938 $<itype>4 = suspend_momentary ();
1939 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1940 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1942 /* Note how the declaration of the variable is in effect while its init is parsed! */
1943 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1945 | declarator maybeasm maybe_attribute
1947 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1948 &prefix_attributes);
1949 if (current_declspecs
1950 && TREE_CODE (current_declspecs) != TREE_LIST)
1951 current_declspecs = get_decl_list (current_declspecs);
1952 if (have_extern_spec && !used_extern_spec)
1954 current_declspecs = decl_tree_cons
1955 (NULL_TREE, get_identifier ("extern"),
1957 used_extern_spec = 1;
1959 $$ = suspend_momentary ();
1960 d = start_decl ($<ttype>1, current_declspecs, 0);
1961 cplus_decl_attributes (d, $3, prefix_attributes);
1962 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1966 declarator maybeasm maybe_attribute '='
1967 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1968 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1970 /* Note how the declaration of the variable is in effect while its init is parsed! */
1971 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING); }
1972 | declarator maybeasm maybe_attribute
1973 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0);
1974 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes);
1975 cp_finish_decl ($<ttype>$, NULL_TREE, $2, 1, 0); }
1979 notype_declarator maybeasm maybe_attribute '='
1980 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1981 &prefix_attributes);
1982 $<itype>4 = suspend_momentary ();
1983 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1984 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1986 /* Note how the declaration of the variable is in effect while its init is parsed! */
1987 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1989 | notype_declarator maybeasm maybe_attribute
1991 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1992 &prefix_attributes);
1993 $$ = suspend_momentary ();
1994 d = start_decl ($<ttype>1, current_declspecs, 0);
1995 cplus_decl_attributes (d, $3, prefix_attributes);
1996 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
2000 notype_declarator maybeasm maybe_attribute '='
2001 { current_declspecs = NULL_TREE;
2002 prefix_attributes = NULL_TREE;
2003 $<itype>4 = suspend_momentary ();
2004 $<ttype>$ = start_decl ($1, current_declspecs, 1);
2005 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
2007 /* Note how the declaration of the variable is in effect while its init is parsed! */
2008 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
2010 | notype_declarator maybeasm maybe_attribute
2012 current_declspecs = NULL_TREE;
2013 prefix_attributes = NULL_TREE;
2014 $$ = suspend_momentary ();
2015 d = start_decl ($1, current_declspecs, 0);
2016 cplus_decl_attributes (d, $3, prefix_attributes);
2017 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
2020 /* the * rules are dummies to accept the Apollo extended syntax
2021 so that the header files compile. */
2032 | attributes attribute
2033 { $$ = chainon ($1, $2); }
2037 ATTRIBUTE '(' '(' attribute_list ')' ')'
2044 | attribute_list ',' attrib
2045 { $$ = chainon ($1, $3); }
2052 { $$ = build_tree_list ($1, NULL_TREE); }
2053 | any_word '(' IDENTIFIER ')'
2054 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2055 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2056 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2057 | any_word '(' nonnull_exprlist ')'
2058 { $$ = build_tree_list ($1, $3); }
2061 /* This still leaves out most reserved keywords,
2062 shouldn't we include them? */
2071 /* A nonempty list of identifiers, including typenames. */
2072 identifiers_or_typenames:
2074 { $$ = build_tree_list (NULL_TREE, $1); }
2075 | identifiers_or_typenames ',' identifier
2076 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2080 /* empty */ %prec EMPTY
2085 /* If we are processing a template, we don't want to expand this
2089 expr_no_commas %prec '='
2091 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2092 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2094 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2095 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2096 | '{' initlist ',' '}'
2097 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2098 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2103 /* This chain is built in reverse order,
2104 and put in forward order where initlist is used. */
2107 { $$ = build_tree_list (NULL_TREE, $$); }
2109 { $$ = tree_cons (NULL_TREE, $3, $$); }
2110 /* These are for labeled elements. */
2111 | '[' expr_no_commas ']' init
2112 { $$ = build_tree_list ($2, $4); }
2113 | initlist ',' CASE expr_no_commas ':' init
2114 { $$ = tree_cons ($4, $6, $$); }
2115 | identifier ':' init
2116 { $$ = build_tree_list ($$, $3); }
2117 | initlist ',' identifier ':' init
2118 { $$ = tree_cons ($3, $5, $$); }
2122 PRE_PARSED_FUNCTION_DECL
2123 { start_function (NULL_TREE, TREE_VALUE ($1),
2125 reinit_parse_for_function (); }
2128 fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
2130 int nested = (hack_decl_function_context
2131 (current_function_decl) != NULL_TREE);
2132 finish_function (lineno, (int)$3, nested);
2133 process_next_inline ($1);
2135 | fn.defpen maybe_return_init function_try_block
2136 { process_next_inline ($1); }
2137 | fn.defpen maybe_return_init error
2138 { process_next_inline ($1); }
2143 | pending_inlines pending_inline eat_saved_input
2146 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2147 the TREE_LIST node for the parameter in question. */
2149 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2150 { replace_defarg ($1, $2); }
2151 | DEFARG_MARKER error END_OF_SAVED_INPUT
2152 { replace_defarg ($1, error_mark_node); }
2155 /* empty */ %prec EMPTY
2156 | pending_defargs defarg_again
2157 { do_pending_defargs (); }
2158 | pending_defargs error
2159 { do_pending_defargs (); }
2164 { $<itype>3 = suspend_momentary ();
2165 $<ttype>$ = start_enum ($2); }
2166 enumlist maybecomma_warn '}'
2167 { $$.t = finish_enum ($<ttype>4, $5);
2168 $$.new_type_flag = 1;
2169 resume_momentary ((int) $<itype>3);
2170 check_for_missing_semicolon ($<ttype>4); }
2171 | ENUM identifier '{' '}'
2172 { $$.t = finish_enum (start_enum ($2), NULL_TREE);
2173 $$.new_type_flag = 1;
2174 check_for_missing_semicolon ($$.t); }
2176 { $<itype>2 = suspend_momentary ();
2177 $<ttype>$ = start_enum (make_anon_name ()); }
2178 enumlist maybecomma_warn '}'
2179 { $$.t = finish_enum ($<ttype>3, $4);
2180 resume_momentary ((int) $<itype>1);
2181 check_for_missing_semicolon ($<ttype>3);
2182 $$.new_type_flag = 1; }
2184 { $$.t = finish_enum (start_enum (make_anon_name()), NULL_TREE);
2185 $$.new_type_flag = 1;
2186 check_for_missing_semicolon ($$.t); }
2188 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2189 $$.new_type_flag = 0; }
2190 | ENUM complex_type_name
2191 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2192 $$.new_type_flag = 0; }
2193 | TYPENAME_KEYWORD nested_name_specifier identifier
2194 { $$.t = make_typename_type ($2, $3);
2195 $$.new_type_flag = 0; }
2196 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2197 { $$.t = make_typename_type ($3, $4);
2198 $$.new_type_flag = 0; }
2199 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2200 | class_head left_curly opt.component_decl_list '}' maybe_attribute
2207 /* Need to rework class nesting in the
2208 presence of nested classes, etc. */
2209 shadow_tag (CLASSTYPE_AS_LIST ($1)); */
2211 if (yychar == YYEMPTY)
2213 semi = yychar == ';';
2214 /* finish_struct nukes this anyway; if
2215 finish_exception does too, then it can go. */
2217 note_got_semicolon ($1);
2219 if (TREE_CODE ($1) == ENUMERAL_TYPE)
2223 $<ttype>$ = finish_struct ($1, $3, $5, semi);
2224 if (semi) note_got_semicolon ($<ttype>$);
2230 check_for_missing_semicolon ($1);
2231 if (current_scope () == current_function_decl)
2232 do_pending_defargs ();
2237 && current_scope () == current_function_decl)
2238 do_pending_inlines ();
2243 $$.new_type_flag = 1;
2244 if (current_class_type == NULL_TREE)
2245 clear_inline_text_obstack ();
2247 | class_head %prec EMPTY
2250 $$.new_type_flag = 0;
2251 /* struct B: public A; is not accepted by the WP grammar. */
2252 if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
2253 && ! TYPE_BEING_DEFINED ($$.t))
2254 cp_error ("base clause without member specification for `%#T'",
2267 { if (pedantic && !in_system_header)
2268 pedwarn ("comma at end of enumerator list"); }
2274 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2276 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2278 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2280 { error ("no body nor ';' separates two class, struct or union declarations"); }
2283 named_class_head_sans_basetype:
2285 { current_aggr = $$; $$ = $2; }
2288 named_class_head_sans_basetype_defn:
2289 aggr identifier_defn %prec EMPTY
2290 { current_aggr = $$; $$ = $2; }
2293 named_complex_class_head_sans_basetype:
2294 aggr nested_name_specifier identifier
2297 $$ = handle_class_head ($1, $2, $3);
2299 | aggr global_scope nested_name_specifier identifier
2302 $$ = handle_class_head ($1, $3, $4);
2304 | aggr global_scope identifier
2307 $$ = handle_class_head ($1, NULL_TREE, $3);
2309 | aggr template_type
2310 { current_aggr = $$; $$ = $2; }
2311 | aggr nested_name_specifier template_type
2312 { current_aggr = $$; $$ = $3; }
2316 /* empty */ %prec EMPTY
2317 { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
2321 named_class_head_sans_basetype %prec EMPTY
2322 { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
2323 | named_class_head_sans_basetype_defn do_xref_defn
2324 maybe_base_class_list %prec EMPTY
2328 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2330 | named_complex_class_head_sans_basetype maybe_base_class_list
2332 $$ = TREE_TYPE ($1);
2333 if (TREE_INT_CST_LOW (current_aggr) == union_type
2334 && TREE_CODE ($$) != UNION_TYPE)
2335 cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
2336 else if (TREE_CODE ($$) == UNION_TYPE
2337 && TREE_INT_CST_LOW (current_aggr) != union_type)
2338 cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
2341 if (IS_AGGR_TYPE ($$) && CLASSTYPE_USE_TEMPLATE ($$))
2343 if (CLASSTYPE_IMPLICIT_INSTANTIATION ($$)
2344 && TYPE_SIZE ($$) == NULL_TREE)
2346 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION ($$);
2347 if (processing_template_decl)
2348 push_template_decl (TYPE_MAIN_DECL ($$));
2350 else if (CLASSTYPE_TEMPLATE_INSTANTIATION ($$))
2351 cp_error ("specialization after instantiation of `%T'", $$);
2353 xref_basetypes (current_aggr, $1, $$, $2);
2360 { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
2361 yyungetc ('{', 1); }
2369 maybe_base_class_list:
2370 /* empty */ %prec EMPTY
2372 | ':' see_typename %prec EMPTY
2373 { yyungetc(':', 1); $$ = NULL_TREE; }
2374 | ':' see_typename base_class_list %prec EMPTY
2380 | base_class_list ',' see_typename base_class
2381 { $$ = chainon ($$, $4); }
2387 tree type = TREE_TYPE ($1);
2388 if (! is_aggr_type (type, 1))
2390 else if (current_aggr == signature_type_node
2391 && (! type) && (! IS_SIGNATURE (type)))
2393 error ("class name not allowed as base signature");
2396 else if (current_aggr == signature_type_node)
2398 sorry ("signature inheritance, base type `%s' ignored",
2399 IDENTIFIER_POINTER ($$));
2400 $$ = build_tree_list (access_public_node, type);
2402 else if (type && IS_SIGNATURE (type))
2404 error ("signature name not allowed as base class");
2408 $$ = build_tree_list (access_default_node, type);
2410 | base_class_access_list see_typename base_class.1
2412 tree type = TREE_TYPE ($3);
2413 if (current_aggr == signature_type_node)
2414 error ("access and source specifiers not allowed in signature");
2415 if (! IS_AGGR_TYPE (type))
2417 else if (current_aggr == signature_type_node
2418 && (! type) && (! IS_SIGNATURE (type)))
2420 error ("class name not allowed as base signature");
2423 else if (current_aggr == signature_type_node)
2425 sorry ("signature inheritance, base type `%s' ignored",
2426 IDENTIFIER_POINTER ($$));
2427 $$ = build_tree_list (access_public_node, type);
2429 else if (type && IS_SIGNATURE (type))
2431 error ("signature name not allowed as base class");
2435 $$ = build_tree_list ($$, type);
2441 | TYPENAME_KEYWORD nested_name_specifier identifier
2442 { $$ = TYPE_MAIN_DECL (make_typename_type ($2, $3)); }
2443 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2444 { $$ = TYPE_MAIN_DECL (make_typename_type ($3, $4)); }
2445 | SIGOF '(' expr ')'
2447 if (current_aggr == signature_type_node)
2449 if (IS_AGGR_TYPE (TREE_TYPE ($3)))
2451 sorry ("`sigof' as base signature specifier");
2452 $$ = TREE_TYPE ($3);
2456 error ("`sigof' applied to non-aggregate expression");
2457 $$ = error_mark_node;
2462 error ("`sigof' in struct or class declaration");
2463 $$ = error_mark_node;
2466 | SIGOF '(' type_id ')'
2468 if (current_aggr == signature_type_node)
2470 if (IS_AGGR_TYPE (groktypename ($3.t)))
2472 sorry ("`sigof' as base signature specifier");
2473 $$ = groktypename ($3.t);
2477 error ("`sigof' applied to non-aggregate expression");
2478 $$ = error_mark_node;
2483 error ("`sigof' in struct or class declaration");
2484 $$ = error_mark_node;
2489 base_class_access_list:
2490 VISSPEC see_typename
2491 | SCSPEC see_typename
2492 { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
2493 sorry ("non-virtual access");
2494 $$ = access_default_virtual_node; }
2495 | base_class_access_list VISSPEC see_typename
2497 if ($2 == access_protected_node)
2499 warning ("`protected' access not implemented");
2500 $2 = access_public_node;
2503 else if ($2 == access_public_node)
2505 if ($1 == access_private_node)
2508 error ("base class cannot be public and private");
2510 else if ($1 == access_default_virtual_node)
2511 $$ = access_public_virtual_node;
2513 else /* $2 == access_private_node */
2515 if ($1 == access_public_node)
2517 else if ($1 == access_default_virtual_node)
2518 $$ = access_private_virtual_node;
2521 | base_class_access_list SCSPEC see_typename
2522 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2523 sorry ("non-virtual access");
2524 if ($$ == access_public_node)
2525 $$ = access_public_virtual_node;
2526 else if ($$ == access_private_node)
2527 $$ = access_private_virtual_node; }
2532 { tree t = $<ttype>0;
2533 push_obstacks_nochange ();
2534 end_temporary_allocation ();
2536 if (t == error_mark_node
2537 || ! IS_AGGR_TYPE (t))
2539 t = $<ttype>0 = make_lang_type (RECORD_TYPE);
2540 pushtag (make_anon_name (), t, 0);
2543 duplicate_tag_error (t);
2544 if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
2546 t = make_lang_type (TREE_CODE (t));
2547 pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
2550 if (processing_template_decl && TYPE_CONTEXT (t)
2551 && ! current_class_type)
2552 push_template_decl (TYPE_STUB_DECL (t));
2554 TYPE_BEING_DEFINED (t) = 1;
2555 if (IS_AGGR_TYPE (t) && CLASSTYPE_USE_TEMPLATE (t))
2557 if (CLASSTYPE_IMPLICIT_INSTANTIATION (t)
2558 && TYPE_SIZE (t) == NULL_TREE)
2560 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
2561 if (processing_template_decl)
2562 push_template_decl (TYPE_MAIN_DECL (t));
2564 else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
2565 cp_error ("specialization after instantiation of `%T'", t);
2567 /* Reset the interface data, at the earliest possible
2568 moment, as it might have been set via a class foo;
2570 /* Don't change signatures. */
2571 if (! IS_SIGNATURE (t))
2573 extern tree pending_vtables;
2575 tree name = TYPE_IDENTIFIER (t);
2577 if (! ANON_AGGRNAME_P (name))
2579 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
2580 SET_CLASSTYPE_INTERFACE_UNKNOWN_X
2581 (t, interface_unknown);
2584 /* Record how to set the access of this class's
2585 virtual functions. If write_virtuals == 2 or 3, then
2586 inline virtuals are ``extern inline''. */
2587 switch (write_virtuals)
2594 needs_writing = !! value_member (name, pending_vtables);
2597 needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
2598 && CLASSTYPE_INTERFACE_KNOWN (t);
2603 CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
2606 t = TYPE_IDENTIFIER ($<ttype>0);
2607 if (t && IDENTIFIER_TEMPLATE (t))
2608 overload_template_name (t, 1);
2616 $$ = build_self_reference ();
2620 opt.component_decl_list:
2622 { if ($$) $$ = build_tree_list (access_public_node, $$); }
2623 | self_reference component_decl_list
2625 if (current_aggr == signature_type_node)
2626 $$ = build_tree_list (access_public_node, $2);
2628 $$ = build_tree_list (access_default_node, $2);
2629 if ($1) $$ = tree_cons (access_public_node, $1, $$);
2631 | opt.component_decl_list VISSPEC ':' component_decl_list
2635 if (current_aggr == signature_type_node)
2637 error ("access specifier not allowed in signature");
2638 visspec = access_public_node;
2640 $$ = chainon ($$, build_tree_list (visspec, $4));
2642 | opt.component_decl_list VISSPEC ':'
2644 if (current_aggr == signature_type_node)
2645 error ("access specifier not allowed in signature");
2649 /* Note: we no longer warn about the semicolon after a component_decl_list.
2650 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2651 component_decl_list:
2653 { if ($$ == void_type_node) $$ = NULL_TREE;
2655 | component_decl_list component_decl
2656 { /* In pushdecl, we created a reverse list of names
2657 in this binding level. Make sure that the chain
2658 of what we're trying to add isn't the item itself
2659 (which can happen with what pushdecl's doing). */
2660 if ($2 != NULL_TREE && $2 != void_type_node)
2662 if (TREE_CHAIN ($2) != $$)
2663 $$ = chainon ($$, $2);
2671 component_decl_1 ';'
2673 | component_decl_1 '}'
2674 { error ("missing ';' before right brace");
2675 yyungetc ('}', 0); }
2676 /* C++: handle constructors, destructors and inline functions */
2677 /* note that INLINE is like a TYPESPEC */
2678 | fn.def2 ':' /* base_init compstmt */
2679 { $$ = finish_method ($$); }
2680 | fn.def2 TRY /* base_init compstmt */
2681 { $$ = finish_method ($$); }
2682 | fn.def2 RETURN /* base_init compstmt */
2683 { $$ = finish_method ($$); }
2684 | fn.def2 '{' /* nodecls compstmt */
2685 { $$ = finish_method ($$); }
2688 | extension component_decl
2690 pedantic = $<itype>1; }
2694 /* Do not add a "typed_declspecs declarator" rule here for
2695 speed; we need to call grok_x_components for enums, so the
2696 speedup would be insignificant. */
2697 typed_declspecs components
2698 { $$ = grok_x_components ($1.t, $2); }
2699 | declmods notype_components
2700 { $$ = grok_x_components ($1, $2); }
2701 | notype_declarator maybeasm maybe_attribute maybe_init
2702 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2703 build_tree_list ($3, NULL_TREE)); }
2704 | constructor_declarator maybeasm maybe_attribute maybe_init
2705 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2706 build_tree_list ($3, NULL_TREE)); }
2707 | ':' expr_no_commas
2708 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2712 /* These rules introduce a reduce/reduce conflict; in
2713 typedef int foo, bar;
2717 should "A::foo" be declared as a function or "A::bar" as a data
2718 member? In other words, is "bar" an after_type_declarator or a
2720 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2721 { tree specs, attrs;
2722 split_specs_attrs ($1, &specs, &attrs);
2723 $$ = grokfield ($2, specs, $5, $3,
2724 build_tree_list ($4, attrs)); }
2725 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2726 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2727 build_tree_list ($3, NULL_TREE)); }
2729 { $$ = do_class_using_decl ($1); }
2730 | template_header component_decl_1
2732 end_template_decl ();
2733 if ($2 && DECL_TEMPLATE_INFO ($2))
2735 $$ = DECL_TI_TEMPLATE ($2);
2736 check_member_template ($$);
2742 cp_error("invalid member template declaration");
2747 /* The case of exactly one component is handled directly by component_decl. */
2750 /* empty: possibly anonymous */
2752 | component_declarator0
2753 | components ',' component_declarator
2755 /* In this context, void_type_node encodes
2756 friends. They have been recorded elsewhere. */
2757 if ($$ == void_type_node)
2760 $$ = chainon ($$, $3);
2765 /* empty: possibly anonymous */
2767 | notype_component_declarator0
2768 | notype_components ',' notype_component_declarator
2770 /* In this context, void_type_node encodes
2771 friends. They have been recorded elsewhere. */
2772 if ($$ == void_type_node)
2775 $$ = chainon ($$, $3);
2779 component_declarator0:
2780 after_type_component_declarator0
2781 | notype_component_declarator0
2784 component_declarator:
2785 after_type_component_declarator
2786 | notype_component_declarator
2789 after_type_component_declarator0:
2790 after_type_declarator maybeasm maybe_attribute maybe_init
2791 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2792 &prefix_attributes);
2793 $<ttype>0 = current_declspecs;
2794 $$ = grokfield ($$, current_declspecs, $4, $2,
2795 build_tree_list ($3, prefix_attributes)); }
2796 | TYPENAME ':' expr_no_commas maybe_attribute
2797 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2798 &prefix_attributes);
2799 $<ttype>0 = current_declspecs;
2800 $$ = grokbitfield ($$, current_declspecs, $3);
2801 cplus_decl_attributes ($$, $4, prefix_attributes); }
2804 notype_component_declarator0:
2805 notype_declarator maybeasm maybe_attribute maybe_init
2806 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2807 &prefix_attributes);
2808 $<ttype>0 = current_declspecs;
2809 $$ = grokfield ($$, current_declspecs, $4, $2,
2810 build_tree_list ($3, prefix_attributes)); }
2811 | constructor_declarator maybeasm maybe_attribute maybe_init
2812 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2813 &prefix_attributes);
2814 $<ttype>0 = current_declspecs;
2815 $$ = grokfield ($$, current_declspecs, $4, $2,
2816 build_tree_list ($3, prefix_attributes)); }
2817 | IDENTIFIER ':' expr_no_commas maybe_attribute
2818 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2819 &prefix_attributes);
2820 $<ttype>0 = current_declspecs;
2821 $$ = grokbitfield ($$, current_declspecs, $3);
2822 cplus_decl_attributes ($$, $4, prefix_attributes); }
2823 | ':' expr_no_commas maybe_attribute
2824 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2825 &prefix_attributes);
2826 $<ttype>0 = current_declspecs;
2827 $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2828 cplus_decl_attributes ($$, $3, prefix_attributes); }
2831 after_type_component_declarator:
2832 after_type_declarator maybeasm maybe_attribute maybe_init
2833 { $$ = grokfield ($$, current_declspecs, $4, $2,
2834 build_tree_list ($3, prefix_attributes)); }
2835 | TYPENAME ':' expr_no_commas maybe_attribute
2836 { $$ = grokbitfield ($$, current_declspecs, $3);
2837 cplus_decl_attributes ($$, $4, prefix_attributes); }
2840 notype_component_declarator:
2841 notype_declarator maybeasm maybe_attribute maybe_init
2842 { $$ = grokfield ($$, current_declspecs, $4, $2,
2843 build_tree_list ($3, prefix_attributes)); }
2844 | IDENTIFIER ':' expr_no_commas maybe_attribute
2845 { $$ = grokbitfield ($$, current_declspecs, $3);
2846 cplus_decl_attributes ($$, $4, prefix_attributes); }
2847 | ':' expr_no_commas maybe_attribute
2848 { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2849 cplus_decl_attributes ($$, $3, prefix_attributes); }
2852 /* We chain the enumerators in reverse order.
2853 Because of the way enums are built, the order is
2854 insignificant. Take advantage of this fact. */
2858 | enumlist ',' enumerator
2859 { TREE_CHAIN ($3) = $$; $$ = $3; }
2864 { $$ = build_enumerator ($$, NULL_TREE); }
2865 | identifier '=' expr_no_commas
2866 { $$ = build_enumerator ($$, $3); }
2869 /* ANSI new-type-id (5.3.4) */
2871 type_specifier_seq new_declarator
2872 { $$.t = build_decl_list ($1.t, $2);
2873 $$.new_type_flag = $1.new_type_flag; }
2874 | type_specifier_seq %prec EMPTY
2875 { $$.t = build_decl_list ($1.t, NULL_TREE);
2876 $$.new_type_flag = $1.new_type_flag; }
2877 /* GNU extension to allow arrays of arbitrary types with
2878 non-constant dimension. */
2879 | '(' type_id ')' '[' expr ']'
2882 pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
2883 $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
2884 $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
2885 $$.new_type_flag = $2.new_type_flag;
2890 /* empty */ %prec EMPTY
2892 | cv_qualifiers CV_QUALIFIER
2893 { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
2896 nonempty_cv_qualifiers:
2898 { $$.t = IDENTIFIER_AS_LIST ($1);
2899 $$.new_type_flag = 0; }
2900 | nonempty_cv_qualifiers CV_QUALIFIER
2901 { $$.t = decl_tree_cons (NULL_TREE, $2, $1.t);
2902 $$.new_type_flag = $1.new_type_flag; }
2905 /* These rules must follow the rules for function declarations
2906 and component declarations. That way, longer rules are preferred. */
2910 { $<itype>$ = suspend_momentary (); }
2912 /* An expression which will not live on the momentary obstack. */
2915 { resume_momentary ((int) $<itype>1); $$ = $2; }
2918 /* An expression which will not live on the momentary obstack. */
2920 suspend_mom '(' nonnull_exprlist ')'
2921 { resume_momentary ((int) $<itype>1); $$ = $3; }
2922 | suspend_mom '(' parmlist ')'
2923 { resume_momentary ((int) $<itype>1); $$ = $3; }
2924 | suspend_mom LEFT_RIGHT
2925 { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
2926 | suspend_mom '(' error ')'
2927 { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
2930 /* A declarator that is allowed only after an explicit typespec. */
2931 /* may all be followed by prec '.' */
2932 after_type_declarator:
2933 '*' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2934 { $$ = make_pointer_declarator ($2.t, $3); }
2935 | '&' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2936 { $$ = make_reference_declarator ($2.t, $3); }
2937 | '*' after_type_declarator %prec UNARY
2938 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2939 | '&' after_type_declarator %prec UNARY
2940 { $$ = make_reference_declarator (NULL_TREE, $2); }
2941 | ptr_to_mem cv_qualifiers after_type_declarator
2942 { tree arg = make_pointer_declarator ($2, $3);
2943 $$ = build_parse_node (SCOPE_REF, $1, arg);
2945 | direct_after_type_declarator
2949 type_name %prec EMPTY
2951 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2953 if (current_class_type
2954 && TYPE_BEING_DEFINED (current_class_type)
2955 && ! IDENTIFIER_CLASS_VALUE ($1))
2957 /* Be sure to get an inherited typedef. */
2958 $$ = lookup_name ($1, 1);
2959 /* Remember that this name has been used in the class
2960 definition, as per [class.scope0] */
2961 pushdecl_class_level ($$);
2964 $$ = identifier_typedecl_value ($1);
2969 | global_scope type_name
2971 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2972 $$ = identifier_typedecl_value ($2);
2975 got_scope = NULL_TREE;
2978 | global_scope nested_type
2983 nested_name_specifier type_name %prec EMPTY
2984 { $$ = get_type_decl ($2); }
2987 direct_after_type_declarator:
2988 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2989 { $$ = make_call_declarator ($$, $2, $3, $4); }
2990 | direct_after_type_declarator '[' nonmomentary_expr ']'
2991 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2992 | direct_after_type_declarator '[' ']'
2993 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2994 | '(' after_type_declarator ')'
2996 | nested_name_specifier type_name %prec EMPTY
2997 { push_nested_class ($1, 3);
2998 $$ = build_parse_node (SCOPE_REF, $$, $2);
2999 TREE_COMPLEXITY ($$) = current_class_depth; }
3000 | type_name %prec EMPTY
3003 /* A declarator allowed whether or not there has been
3004 an explicit typespec. These cannot redeclare a typedef-name. */
3007 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
3008 { $$ = make_pointer_declarator ($2.t, $3); }
3009 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
3010 { $$ = make_reference_declarator ($2.t, $3); }
3011 | '*' notype_declarator %prec UNARY
3012 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3013 | '&' notype_declarator %prec UNARY
3014 { $$ = make_reference_declarator (NULL_TREE, $2); }
3015 | ptr_to_mem cv_qualifiers notype_declarator
3016 { tree arg = make_pointer_declarator ($2, $3);
3017 $$ = build_parse_node (SCOPE_REF, $1, arg);
3019 | direct_notype_declarator
3022 complex_notype_declarator:
3023 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
3024 { $$ = make_pointer_declarator ($2.t, $3); }
3025 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
3026 { $$ = make_reference_declarator ($2.t, $3); }
3027 | '*' complex_notype_declarator %prec UNARY
3028 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3029 | '&' complex_notype_declarator %prec UNARY
3030 { $$ = make_reference_declarator (NULL_TREE, $2); }
3031 | ptr_to_mem cv_qualifiers notype_declarator
3032 { tree arg = make_pointer_declarator ($2, $3);
3033 $$ = build_parse_node (SCOPE_REF, $1, arg);
3035 | complex_direct_notype_declarator
3038 complex_direct_notype_declarator:
3039 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
3040 { $$ = make_call_declarator ($$, $2, $3, $4); }
3041 | '(' complex_notype_declarator ')'
3043 | direct_notype_declarator '[' nonmomentary_expr ']'
3044 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3045 | direct_notype_declarator '[' ']'
3046 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3047 | notype_qualified_id
3048 { if (OP0 ($$) != current_class_type)
3050 push_nested_class (OP0 ($$), 3);
3051 TREE_COMPLEXITY ($$) = current_class_depth;
3057 nested_name_specifier unqualified_id
3058 { got_scope = NULL_TREE;
3059 $$ = build_parse_node (SCOPE_REF, $$, $2); }
3062 notype_qualified_id:
3063 nested_name_specifier notype_unqualified_id
3064 { got_scope = NULL_TREE;
3065 $$ = build_parse_node (SCOPE_REF, $$, $2); }
3070 | global_scope notype_qualified_id
3075 typespec '(' nonnull_exprlist ')'
3076 { $$ = build_functional_cast ($1.t, $3); }
3077 | typespec '(' expr_or_declarator ')'
3078 { $$ = reparse_decl_as_expr ($1.t, $3); }
3079 | typespec fcast_or_absdcl %prec EMPTY
3080 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3086 | template_type %prec EMPTY
3089 nested_name_specifier:
3090 nested_name_specifier_1
3091 | nested_name_specifier nested_name_specifier_1
3095 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3096 inline here?!? (jason) */
3097 nested_name_specifier_1:
3100 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3103 /* Remember that this name has been used in the class
3104 definition, as per [class.scope0] */
3105 if (current_class_type
3106 && TYPE_BEING_DEFINED (current_class_type)
3107 && ! IDENTIFIER_CLASS_VALUE ($1))
3108 pushdecl_class_level ($$);
3110 got_scope = $$ = TREE_TYPE ($$);
3114 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3116 got_scope = $$ = TREE_TYPE ($$);
3120 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3122 if (TREE_CODE ($$) == NAMESPACE_DECL
3123 && DECL_NAME ($$) == get_identifier ("std"))
3124 got_scope = void_type_node;
3128 | template_type SCOPE
3129 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3130 /* These break 'const i;'
3134 cp_error ("`%D' is not an aggregate typedef",
3135 lastiddecl ? lastiddecl : $$);
3136 $$ = error_mark_node;
3139 { goto failed_scope; } */
3143 global_scope type_name
3145 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3146 $$ = identifier_typedecl_value ($2);
3149 got_scope = NULL_TREE;
3152 | global_scope nested_type
3157 nested_name_specifier '*'
3158 { got_scope = NULL_TREE; }
3159 | global_scope nested_name_specifier '*'
3160 { $$ = $2; got_scope = NULL_TREE; }
3163 /* All uses of explicit global scope must go through this nonterminal so
3164 that got_scope will be set before yylex is called to get the next token. */
3167 { got_scope = void_type_node; }
3170 /* ANSI new-declarator (5.3.4) */
3172 '*' cv_qualifiers new_declarator
3173 { $$ = make_pointer_declarator ($2, $3); }
3174 | '*' cv_qualifiers %prec EMPTY
3175 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3176 | '&' cv_qualifiers new_declarator %prec EMPTY
3177 { $$ = make_reference_declarator ($2, $3); }
3178 | '&' cv_qualifiers %prec EMPTY
3179 { $$ = make_reference_declarator ($2, NULL_TREE); }
3180 | ptr_to_mem cv_qualifiers %prec EMPTY
3181 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3182 $$ = build_parse_node (SCOPE_REF, $1, arg);
3184 | ptr_to_mem cv_qualifiers new_declarator
3185 { tree arg = make_pointer_declarator ($2, $3);
3186 $$ = build_parse_node (SCOPE_REF, $1, arg);
3188 | direct_new_declarator %prec EMPTY
3191 /* ANSI direct-new-declarator (5.3.4) */
3192 direct_new_declarator:
3194 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3195 | direct_new_declarator '[' nonmomentary_expr ']'
3196 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3199 /* ANSI abstract-declarator (8.1) */
3201 '*' nonempty_cv_qualifiers absdcl
3202 { $$ = make_pointer_declarator ($2.t, $3); }
3204 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3205 | '*' nonempty_cv_qualifiers %prec EMPTY
3206 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3208 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3209 | '&' nonempty_cv_qualifiers absdcl
3210 { $$ = make_reference_declarator ($2.t, $3); }
3212 { $$ = make_reference_declarator (NULL_TREE, $2); }
3213 | '&' nonempty_cv_qualifiers %prec EMPTY
3214 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3216 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3217 | ptr_to_mem cv_qualifiers %prec EMPTY
3218 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3219 $$ = build_parse_node (SCOPE_REF, $1, arg);
3221 | ptr_to_mem cv_qualifiers absdcl
3222 { tree arg = make_pointer_declarator ($2, $3);
3223 $$ = build_parse_node (SCOPE_REF, $1, arg);
3225 | direct_abstract_declarator %prec EMPTY
3228 /* ANSI direct-abstract-declarator (8.1) */
3229 direct_abstract_declarator:
3232 /* `(typedef)1' is `int'. */
3234 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3235 { $$ = make_call_declarator ($$, $3, $5, $6); }
3236 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3237 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3238 | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
3239 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3240 | direct_abstract_declarator '[' ']' %prec '.'
3241 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3242 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3243 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3244 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3245 { set_quals_and_spec ($$, $2, $3); }
3246 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3247 { set_quals_and_spec ($$, $2, $3); }
3248 | '[' nonmomentary_expr ']' %prec '.'
3249 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3251 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
3254 /* For C++, decls and stmts can be intermixed, so we don't need to
3255 have a special rule that won't start parsing the stmt section
3256 until we have a stmt that parses without errors. */
3269 /* build the LET_STMT node before parsing its contents,
3270 so that any LET_STMTs within the context can have their display pointers
3271 set up to point at this one. */
3275 { do_pushlevel (); }
3280 { $$ = do_poplevel (); }
3283 /* Read zero or more forward-declarations for labels
3284 that nested functions can jump to. */
3289 pedwarn ("ANSI C++ forbids label declarations"); }
3294 | label_decls label_decl
3298 LABEL identifiers_or_typenames ';'
3300 for (link = $2; link; link = TREE_CHAIN (link))
3302 tree label = shadow_label (TREE_VALUE (link));
3303 C_DECLARED_LABEL_FLAG (label) = 1;
3304 declare_nonlocal_label (label);
3309 /* This is the body of a function definition.
3310 It causes syntax errors to ignore to the next openbrace. */
3320 if (processing_template_decl)
3322 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3323 add_tree ($<ttype>$);
3326 .pushlevel compstmtend .poplevel
3328 if (processing_template_decl)
3330 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3331 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3332 last_tree = $<ttype>2;
3341 if (processing_template_decl)
3343 $<ttype>$ = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE,
3345 add_tree ($<ttype>$);
3347 cond_stmt_keyword = "if";
3349 .pushlevel paren_cond_or_null
3351 if (processing_template_decl)
3353 if (last_tree != $<ttype>2)
3355 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3356 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3357 last_tree = $<ttype>2;
3360 TREE_OPERAND ($<ttype>2, 0) = $4;
3364 emit_line_note (input_filename, lineno);
3365 expand_start_cond ($4, 0);
3368 implicitly_scoped_stmt
3370 if (processing_template_decl)
3372 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3373 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3374 $<ttype>$ = last_tree = $<ttype>2;
3379 implicitly_scoped_stmt:
3384 if (processing_template_decl)
3386 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3387 add_tree ($<ttype>$);
3390 simple_stmt .poplevel
3392 if (processing_template_decl)
3394 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3395 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3396 last_tree = $<ttype>2;
3414 if (! processing_template_decl)
3416 emit_line_note (input_filename, lineno);
3417 /* Do default conversion if safe and possibly important,
3418 in case within ({...}). */
3419 if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
3421 || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
3422 expr = default_conversion (expr);
3424 cplus_expand_expr_stmt (expr);
3428 { if (! processing_template_decl) expand_start_else (); }
3429 implicitly_scoped_stmt
3431 if (processing_template_decl)
3433 TREE_OPERAND ($<ttype>1, 2) = TREE_CHAIN ($<ttype>1);
3434 TREE_CHAIN ($<ttype>1) = NULL_TREE;
3435 last_tree = $<ttype>1;
3442 | simple_if %prec IF
3443 { if (! processing_template_decl) expand_end_cond ();
3448 if (processing_template_decl)
3450 $<ttype>$ = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
3451 add_tree ($<ttype>$);
3456 emit_line_note (input_filename, lineno);
3457 expand_start_loop (1);
3459 cond_stmt_keyword = "while";
3461 .pushlevel paren_cond_or_null
3463 if (processing_template_decl)
3465 if (last_tree != $<ttype>2)
3467 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3468 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3469 last_tree = $<ttype>2;
3472 TREE_OPERAND ($<ttype>2, 0) = $4;
3476 emit_line_note (input_filename, lineno);
3477 expand_exit_loop_if_false (0, $4);
3480 already_scoped_stmt .poplevel
3482 if (processing_template_decl)
3484 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3485 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3486 last_tree = $<ttype>2;
3494 if (processing_template_decl)
3496 $<ttype>$ = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
3497 add_tree ($<ttype>$);
3502 emit_line_note (input_filename, lineno);
3503 expand_start_loop_continue_elsewhere (1);
3506 implicitly_scoped_stmt WHILE
3508 if (processing_template_decl)
3510 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3511 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3512 last_tree = $<ttype>2;
3516 expand_loop_continue_here ();
3517 cond_stmt_keyword = "do";
3520 paren_expr_or_null ';'
3522 if (processing_template_decl)
3523 TREE_OPERAND ($<ttype>2, 1) = $6;
3526 emit_line_note (input_filename, lineno);
3527 expand_exit_loop_if_false (0, $6);
3534 { if (processing_template_decl)
3536 $<ttype>$ = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
3537 NULL_TREE, NULL_TREE);
3538 add_tree ($<ttype>$);
3541 emit_line_note (input_filename, lineno);
3542 if (flag_new_for_scope > 0)
3544 /* Conditionalize .pushlevel */
3546 note_level_for_for ();
3549 expand_start_bindings (0);
3552 '(' for.init.statement
3554 if (processing_template_decl)
3556 if (last_tree != $<ttype>2)
3558 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3559 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3560 last_tree = $<ttype>2;
3566 emit_line_note (input_filename, lineno);
3567 expand_start_loop_continue_elsewhere (1);
3570 .pushlevel xcond ';'
3572 if (processing_template_decl)
3574 if (last_tree != $<ttype>2)
3576 TREE_OPERAND ($<ttype>2, 1) = last_tree;
3577 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3578 last_tree = $<ttype>2;
3581 TREE_OPERAND ($<ttype>2, 1) = $7;
3585 emit_line_note (input_filename, lineno);
3586 if ($7) expand_exit_loop_if_false (0, $7);
3590 /* Don't let the tree nodes for $10 be discarded
3591 by clear_momentary during the parsing of the next stmt. */
3593 if (processing_template_decl)
3594 TREE_OPERAND ($<ttype>2, 2) = $10;
3597 already_scoped_stmt .poplevel
3599 if (processing_template_decl)
3601 TREE_OPERAND ($<ttype>2, 3) = TREE_CHAIN ($<ttype>2);
3602 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3603 last_tree = $<ttype>2;
3607 emit_line_note (input_filename, lineno);
3608 expand_loop_continue_here ();
3609 if ($10) cplus_expand_expr_stmt ($10);
3613 if (flag_new_for_scope > 0)
3618 | SWITCH .pushlevel '(' condition ')'
3620 if (processing_template_decl)
3622 $<ttype>$ = build_min_nt (SWITCH_STMT, $4, NULL_TREE);
3623 add_tree ($<ttype>$);
3627 emit_line_note (input_filename, lineno);
3628 c_expand_start_case ($4);
3631 /* Don't let the tree nodes for $4 be discarded by
3632 clear_momentary during the parsing of the next stmt. */
3635 implicitly_scoped_stmt
3637 if (processing_template_decl)
3639 TREE_OPERAND ($<ttype>6, 1) = TREE_CHAIN ($<ttype>6);
3640 TREE_CHAIN ($<ttype>6) = NULL_TREE;
3641 last_tree = $<ttype>6;
3644 expand_end_case ($4);
3650 | CASE expr_no_commas ':'
3651 { do_case ($2, NULL_TREE); }
3653 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3654 { do_case ($2, $4); }
3657 { do_case (NULL_TREE, NULL_TREE); }
3660 { emit_line_note (input_filename, lineno);
3661 if (processing_template_decl)
3662 add_tree (build_min_nt (BREAK_STMT));
3663 else if ( ! expand_exit_something ())
3664 error ("break statement not within loop or switch"); }
3666 { emit_line_note (input_filename, lineno);
3667 if (processing_template_decl)
3668 add_tree (build_min_nt (CONTINUE_STMT));
3669 else if (! expand_continue_loop (0))
3670 error ("continue statement not within a loop"); }
3672 { emit_line_note (input_filename, lineno);
3673 c_expand_return (NULL_TREE); }
3675 { emit_line_note (input_filename, lineno);
3676 c_expand_return ($2);
3679 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3680 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3681 emit_line_note (input_filename, lineno);
3685 /* This is the case with just output operands. */
3686 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3687 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3688 emit_line_note (input_filename, lineno);
3689 c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
3690 $2 == ridpointers[(int)RID_VOLATILE],
3691 input_filename, lineno);
3694 /* This is the case with input operands as well. */
3695 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
3696 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3697 emit_line_note (input_filename, lineno);
3698 c_expand_asm_operands ($4, $6, $8, NULL_TREE,
3699 $2 == ridpointers[(int)RID_VOLATILE],
3700 input_filename, lineno);
3703 /* This is the case with clobbered registers as well. */
3704 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3705 asm_operands ':' asm_clobbers ')' ';'
3706 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3707 emit_line_note (input_filename, lineno);
3708 c_expand_asm_operands ($4, $6, $8, $10,
3709 $2 == ridpointers[(int)RID_VOLATILE],
3710 input_filename, lineno);
3715 if (processing_template_decl)
3716 add_tree (build_min_nt (GOTO_STMT, $3));
3718 { emit_line_note (input_filename, lineno);
3719 expand_computed_goto ($3); }
3721 | GOTO identifier ';'
3723 if (processing_template_decl)
3724 add_tree (build_min_nt (GOTO_STMT, $2));
3728 emit_line_note (input_filename, lineno);
3729 decl = lookup_label ($2);
3730 TREE_USED (decl) = 1;
3737 { error ("label must be followed by statement");
3748 if (! current_function_parms_stored)
3749 store_parm_decls ();
3750 expand_start_early_try_stmts ();
3752 ctor_initializer_opt compstmt
3753 { expand_start_all_catch (); }
3756 int nested = (hack_decl_function_context
3757 (current_function_decl) != NULL_TREE);
3758 expand_end_all_catch ();
3759 finish_function (lineno, (int)$3, nested);
3766 if (processing_template_decl)
3768 $<ttype>$ = build_min_nt (TRY_BLOCK, NULL_TREE,
3770 add_tree ($<ttype>$);
3774 emit_line_note (input_filename, lineno);
3775 expand_start_try_stmts ();
3780 if (processing_template_decl)
3782 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3783 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3784 last_tree = $<ttype>2;
3787 expand_start_all_catch ();
3791 if (processing_template_decl)
3793 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3794 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3795 last_tree = $<ttype>2;
3798 expand_end_all_catch ();
3804 | handler_seq handler
3810 if (processing_template_decl)
3812 $<ttype>$ = build_min_nt (HANDLER, NULL_TREE,
3814 add_tree ($<ttype>$);
3817 .pushlevel handler_args
3819 if (processing_template_decl)
3821 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3822 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3823 last_tree = $<ttype>2;
3828 if (processing_template_decl)
3830 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3831 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3832 last_tree = $<ttype>2;
3835 expand_end_catch_block ();
3841 typed_typespecs %prec EMPTY
3842 | nonempty_cv_qualifiers %prec EMPTY
3847 { expand_start_catch_block (NULL_TREE, NULL_TREE); }
3848 /* This doesn't allow reference parameters, the below does.
3849 | '(' type_specifier_seq absdcl ')'
3850 { check_for_new_type ("inside exception declarations", $2);
3851 expand_start_catch_block ($2.t, $3); }
3852 | '(' type_specifier_seq ')'
3853 { check_for_new_type ("inside exception declarations", $2);
3854 expand_start_catch_block ($2.t, NULL_TREE); }
3855 | '(' type_specifier_seq notype_declarator ')'
3856 { check_for_new_type ("inside exception declarations", $2);
3857 expand_start_catch_block ($2.t, $3); }
3858 | '(' typed_typespecs after_type_declarator ')'
3859 { check_for_new_type ("inside exception declarations", $2);
3860 expand_start_catch_block ($2.t, $3); }
3861 This allows reference parameters... */
3863 { check_for_new_type ("inside exception declarations", $2);
3864 expand_start_catch_block (TREE_PURPOSE ($2.t),
3865 TREE_VALUE ($2.t)); }
3872 label = define_label (input_filename, lineno, $1);
3873 if (label && ! minimal_parse_mode)
3874 expand_label (label);
3886 { if ($1) cplus_expand_expr_stmt ($1); }
3890 pedwarn ("ANSI C++ forbids compound statements inside for initializations");
3894 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3898 { emit_line_note (input_filename, lineno);
3901 { emit_line_note (input_filename, lineno); }
3912 /* These are the operands other than the first string and colon
3913 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3917 | nonnull_asm_operands
3920 nonnull_asm_operands:
3922 | nonnull_asm_operands ',' asm_operand
3923 { $$ = chainon ($$, $3); }
3928 { $$ = build_tree_list ($$, $3); }
3933 { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
3934 | asm_clobbers ',' STRING
3935 { $$ = tree_cons (NULL_TREE, $3, $$); }
3938 /* This is what appears inside the parens in a function declarator.
3939 Its value is represented in the format that grokdeclarator expects.
3941 In C++, declaring a function with no parameters
3942 means that that function takes *no* parameters. */
3951 { $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3952 TREE_PARMLIST ($$) = 1;
3953 check_for_new_type ("inside parameter list", $1); }
3956 /* This nonterminal does not include the common sequence '(' type_id ')',
3957 as it is ambiguous and must be disambiguated elsewhere. */
3961 $$ = chainon ($$, void_list_node);
3962 TREE_PARMLIST ($$) = 1;
3964 | parms_comma ELLIPSIS
3966 TREE_PARMLIST ($$) = 1;
3968 /* C++ allows an ellipsis without a separating ',' */
3971 TREE_PARMLIST ($$) = 1;
3975 $$ = build_tree_list (NULL_TREE, $1.t);
3976 TREE_PARMLIST ($$) = 1;
3984 TREE_PARMLIST ($$) = 1;
3986 | parms TYPENAME_ELLIPSIS
3988 TREE_PARMLIST ($$) = 1;
3990 | type_id TYPENAME_ELLIPSIS
3992 $$ = build_tree_list (NULL_TREE, $1.t);
3993 TREE_PARMLIST ($$) = 1;
3997 /* This helps us recover from really nasty
3998 parse errors, for example, a missing right
4000 yyerror ("possibly missing ')'");
4001 $$ = chainon ($$, void_list_node);
4002 TREE_PARMLIST ($$) = 1;
4008 /* This helps us recover from really nasty
4009 parse errors, for example, a missing right
4011 yyerror ("possibly missing ')'");
4012 $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
4013 TREE_PARMLIST ($$) = 1;
4019 /* A default argument to a */
4022 { maybe_snarf_defarg (); }
4032 /* A nonempty list of parameter declarations or type names. */
4035 { check_for_new_type ("in a parameter list", $1);
4036 $$ = build_tree_list (NULL_TREE, $1.t); }
4038 { check_for_new_type ("in a parameter list", $1);
4039 $$ = build_tree_list ($2, $1.t); }
4040 | parms_comma full_parm
4041 { check_for_new_type ("in a parameter list", $2);
4042 $$ = chainon ($$, $2.t); }
4043 | parms_comma bad_parm
4044 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
4045 | parms_comma bad_parm '=' init
4046 { $$ = chainon ($$, build_tree_list ($4, $2)); }
4052 { check_for_new_type ("in a parameter list", $1);
4053 $$ = build_tree_list (NULL_TREE, $1.t); }
4056 /* A single parameter declaration or parameter type name,
4057 as found in a parmlist. */
4059 /* Here we expand typed_declspecs inline to avoid mis-parsing of
4060 TYPESPEC IDENTIFIER. */
4061 typed_declspecs1 declarator
4062 { tree specs = strip_attrs ($1.t);
4063 $$.new_type_flag = $1.new_type_flag;
4064 $$.t = build_tree_list (specs, $2); }
4065 | typed_typespecs declarator
4066 { $$.t = build_tree_list ($1.t, $2);
4067 $$.new_type_flag = $1.new_type_flag; }
4068 | typespec declarator
4069 { $$.t = build_tree_list (get_decl_list ($1.t), $2);
4070 $$.new_type_flag = $1.new_type_flag; }
4071 | typed_declspecs1 absdcl
4072 { tree specs = strip_attrs ($1.t);
4073 $$.t = build_tree_list (specs, $2);
4074 $$.new_type_flag = $1.new_type_flag; }
4075 | typed_declspecs1 %prec EMPTY
4076 { tree specs = strip_attrs ($1.t);
4077 $$.t = build_tree_list (specs, NULL_TREE);
4078 $$.new_type_flag = $1.new_type_flag; }
4079 | declmods notype_declarator
4080 { tree specs = strip_attrs ($1);
4081 $$.t = build_tree_list (specs, $2);
4082 $$.new_type_flag = 0; }
4087 { $$.t = build_tree_list (NULL_TREE, $1.t);
4088 $$.new_type_flag = $1.new_type_flag; }
4090 { $$.t = build_tree_list ($2, $1.t);
4091 $$.new_type_flag = $1.new_type_flag; }
4100 /* empty */ %prec EMPTY
4101 { see_typename (); }
4105 /* empty */ %prec EMPTY
4107 error ("type specifier omitted for parameter");
4108 $$ = build_tree_list (integer_type_node, NULL_TREE);
4112 error ("type specifier omitted for parameter");
4113 if (TREE_CODE ($$) == SCOPE_REF
4114 && TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM)
4115 cp_error (" perhaps you want `typename %E' to make it a type", $$);
4116 $$ = build_tree_list (integer_type_node, $$);
4120 exception_specification_opt:
4121 /* empty */ %prec EMPTY
4123 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
4125 | THROW LEFT_RIGHT %prec EMPTY
4126 { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
4129 ansi_raise_identifier:
4131 { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
4134 ansi_raise_identifiers:
4135 ansi_raise_identifier
4136 | ansi_raise_identifiers ',' ansi_raise_identifier
4138 TREE_CHAIN ($3) = $$;
4143 conversion_declarator:
4144 /* empty */ %prec EMPTY
4146 | '*' cv_qualifiers conversion_declarator
4147 { $$ = make_pointer_declarator ($2, $3); }
4148 | '&' cv_qualifiers conversion_declarator
4149 { $$ = make_reference_declarator ($2, $3); }
4150 | ptr_to_mem cv_qualifiers conversion_declarator
4151 { tree arg = make_pointer_declarator ($2, $3);
4152 $$ = build_parse_node (SCOPE_REF, $1, arg);
4158 { got_scope = NULL_TREE; }
4163 { $$ = ansi_opname[MULT_EXPR]; }
4165 { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
4167 { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
4169 { $$ = ansi_opname[PLUS_EXPR]; }
4171 { $$ = ansi_opname[MINUS_EXPR]; }
4173 { $$ = ansi_opname[BIT_AND_EXPR]; }
4175 { $$ = ansi_opname[BIT_IOR_EXPR]; }
4177 { $$ = ansi_opname[BIT_XOR_EXPR]; }
4179 { $$ = ansi_opname[BIT_NOT_EXPR]; }
4181 { $$ = ansi_opname[COMPOUND_EXPR]; }
4182 | operator ARITHCOMPARE
4183 { $$ = ansi_opname[$2]; }
4185 { $$ = ansi_opname[LT_EXPR]; }
4187 { $$ = ansi_opname[GT_EXPR]; }
4188 | operator EQCOMPARE
4189 { $$ = ansi_opname[$2]; }
4191 { $$ = ansi_assopname[$2]; }
4193 { $$ = ansi_opname [MODIFY_EXPR]; }
4195 { $$ = ansi_opname[$2]; }
4197 { $$ = ansi_opname[$2]; }
4199 { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
4200 | operator MINUSMINUS
4201 { $$ = ansi_opname[PREDECREMENT_EXPR]; }
4203 { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
4205 { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
4207 { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
4209 { $$ = ansi_opname[COND_EXPR]; }
4211 { $$ = ansi_opname[$2]; }
4212 | operator POINTSAT %prec EMPTY
4213 { $$ = ansi_opname[COMPONENT_REF]; }
4214 | operator POINTSAT_STAR %prec EMPTY
4215 { $$ = ansi_opname[MEMBER_REF]; }
4216 | operator LEFT_RIGHT
4217 { $$ = ansi_opname[CALL_EXPR]; }
4219 { $$ = ansi_opname[ARRAY_REF]; }
4220 | operator NEW %prec EMPTY
4221 { $$ = ansi_opname[NEW_EXPR]; }
4222 | operator DELETE %prec EMPTY
4223 { $$ = ansi_opname[DELETE_EXPR]; }
4224 | operator NEW '[' ']'
4225 { $$ = ansi_opname[VEC_NEW_EXPR]; }
4226 | operator DELETE '[' ']'
4227 { $$ = ansi_opname[VEC_DELETE_EXPR]; }
4228 /* Names here should be looked up in class scope ALSO. */
4229 | operator type_specifier_seq conversion_declarator
4230 { $$ = grokoptypename ($2.t, $3); }
4232 { $$ = ansi_opname[ERROR_MARK]; }
4239 debug_yytranslate (value)
4242 return yytname[YYTRANSLATE (value)];