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. */
45 /* Since parsers are distinct for each language, put the language string
46 definition here. (fnf) */
47 char *language_string = "GNU C++";
49 extern tree void_list_node;
50 extern struct obstack permanent_obstack;
56 extern int end_of_file;
57 extern int current_class_depth;
58 extern tree last_tree;
60 /* FSF LOCAL dje prefix attributes */
61 extern tree strip_attrs PROTO((tree));
66 /* Like YYERROR but do call yyerror. */
67 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
69 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
70 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
72 /* Contains the statement keyword (if/while/do) to include in an
73 error message if the user supplies an empty conditional expression. */
74 static char *cond_stmt_keyword;
76 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
82 /* Cons up an empty parameter list. */
92 || current_class_type != NULL)
93 parms = void_list_node;
102 %union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; }
104 /* All identifiers that are not reserved words
105 and are not declared typedefs in the current block */
108 /* All identifiers that are declared typedefs in the current block.
109 In some contexts, they are treated just like IDENTIFIER,
110 but they can also serve as typespecs in declarations. */
114 /* Reserved words that specify storage class.
115 yylval contains an IDENTIFIER_NODE which indicates which one. */
118 /* Reserved words that specify type.
119 yylval contains an IDENTIFIER_NODE which indicates which one. */
122 /* Reserved words that qualify type: "const" or "volatile".
123 yylval contains an IDENTIFIER_NODE which indicates which one. */
126 /* Character or numeric constants.
127 yylval is the node for the constant. */
130 /* String constants in raw form.
131 yylval is a STRING_CST node. */
134 /* "...", used for functions with variable arglists. */
137 /* the reserved words */
138 /* SCO include files test "ASM", so use something else. */
139 %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
140 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
142 %token ATTRIBUTE EXTENSION LABEL
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
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
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;
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;
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 ();
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; }
349 { if (pending_lang_change) do_pending_lang_change(); }
351 { if (! toplevel_bindings_p () && ! pseudo_global_level_p())
357 { if (pending_inlines) do_pending_inlines (); }
359 { if (pending_inlines) do_pending_inlines (); }
361 { if (pending_inlines) do_pending_inlines (); }
362 | asm_keyword '(' string ')' ';'
363 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
365 | extern_lang_string '{' extdefs_opt '}'
366 { pop_lang_context (); }
367 | extern_lang_string .hush_warning fndef .warning_ok
368 { if (pending_inlines) do_pending_inlines ();
369 pop_lang_context (); }
370 | extern_lang_string .hush_warning datadef .warning_ok
371 { if (pending_inlines) do_pending_inlines ();
372 pop_lang_context (); }
373 | NAMESPACE identifier '{'
374 { push_namespace ($2); }
376 { pop_namespace (); }
378 { push_namespace (NULL_TREE); }
380 { pop_namespace (); }
381 | NAMESPACE identifier '=' any_id ';'
382 { do_namespace_alias ($2, $4); }
384 { do_toplevel_using_decl ($1); }
385 | USING NAMESPACE any_id ';'
386 { do_using_directive ($3); }
392 | USING global_scope qualified_id
394 | USING global_scope unqualified_id
401 | global_scope qualified_id
403 | global_scope unqualified_id
409 { push_lang_context ($1); }
410 | extern_lang_string EXTERN_LANG_STRING
411 { if (current_lang_name != $2)
412 cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
413 pop_lang_context (); push_lang_context ($2); }
418 { begin_template_parm_list (); }
419 template_parm_list '>'
420 { $$ = end_template_parm_list ($4); }
427 { $$ = process_template_parm (NULL_TREE, $1); }
428 | template_parm_list ',' template_parm
429 { $$ = process_template_parm ($1, $3); }
435 $$ = build_tree_list ($1, NULL_TREE);
437 if (TREE_PURPOSE ($$) == signature_type_node)
438 sorry ("signature as template type parameter");
439 else if (TREE_PURPOSE ($$) != class_type_node)
441 pedwarn ("template type parameters must use the keyword `class'");
442 TREE_PURPOSE ($$) = class_type_node;
446 { $$ = build_tree_list ($1, $2); goto ttpa; }
448 { $$ = build_tree_list (class_type_node, NULL_TREE); }
449 | TYPENAME_KEYWORD identifier
450 { $$ = build_tree_list (class_type_node, $2); }
454 /* The following rules introduce a new reduce/reduce
455 conflict on the ',' and '>' input tokens: they are valid
456 prefixes for a `structsp', which means they could match a
457 nameless parameter. See 14.6, paragraph 3.
458 By putting them before the `parm' rule, we get
459 their match before considering them nameless parameter
462 { $$ = build_tree_list (NULL_TREE, $1); }
463 | template_type_parm '=' type_id
464 { $$ = build_tree_list (groktypename ($3.t), $1); }
466 { $$ = build_tree_list (NULL_TREE, $1.t); }
467 | parm '=' expr_no_commas %prec ARITHCOMPARE
468 { $$ = build_tree_list ($3, $1.t); }
474 { end_template_decl (); }
477 { end_template_decl (); }
483 | declmods notype_initdecls ';'
485 | typed_declspecs initdecls ';'
487 note_list_got_semicolon ($1.t);
490 { pedwarn ("empty declaration"); }
491 | explicit_instantiation ';'
492 | typed_declspecs ';'
495 split_specs_attrs ($1.t, &t, &attrs);
497 note_list_got_semicolon ($1.t);
504 ctor_initializer_opt:
523 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
524 { finish_function (lineno, (int)$3, 0); }
525 | fn.def1 maybe_return_init function_try_block
526 { if ($<ttype>$) process_next_inline ($<ttype>$); }
530 constructor_declarator:
531 nested_name_specifier SELFNAME '('
533 $$ = build_parse_node (SCOPE_REF, $1, $2);
534 if ($1 != current_class_type)
536 push_nested_class ($1, 3);
537 TREE_COMPLEXITY ($$) = current_class_depth;
540 parmlist ')' cv_qualifiers exception_specification_opt
541 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
542 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
544 $$ = build_parse_node (SCOPE_REF, $1, $2);
545 if ($1 != current_class_type)
547 push_nested_class ($1, 3);
548 TREE_COMPLEXITY ($$) = current_class_depth;
550 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
552 | global_scope nested_name_specifier SELFNAME '('
554 $$ = build_parse_node (SCOPE_REF, $2, $3);
555 if ($2 != current_class_type)
557 push_nested_class ($2, 3);
558 TREE_COMPLEXITY ($$) = current_class_depth;
561 parmlist ')' cv_qualifiers exception_specification_opt
562 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
563 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
565 $$ = build_parse_node (SCOPE_REF, $2, $3);
566 if ($2 != current_class_type)
568 push_nested_class ($2, 3);
569 TREE_COMPLEXITY ($$) = current_class_depth;
571 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
573 | nested_name_specifier self_template_type '('
575 $$ = build_parse_node (SCOPE_REF, $1, $2);
576 if ($1 != current_class_type)
578 push_nested_class ($1, 3);
579 TREE_COMPLEXITY ($$) = current_class_depth;
582 parmlist ')' cv_qualifiers exception_specification_opt
583 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
584 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
586 $$ = build_parse_node (SCOPE_REF, $1, $2);
587 if ($1 != current_class_type)
589 push_nested_class ($1, 3);
590 TREE_COMPLEXITY ($$) = current_class_depth;
592 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
594 | global_scope nested_name_specifier self_template_type '('
596 $$ = build_parse_node (SCOPE_REF, $2, $3);
597 if ($2 != current_class_type)
599 push_nested_class ($2, 3);
600 TREE_COMPLEXITY ($$) = current_class_depth;
603 parmlist ')' cv_qualifiers exception_specification_opt
604 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
605 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
607 $$ = build_parse_node (SCOPE_REF, $2, $3);
608 if ($2 != current_class_type)
610 push_nested_class ($2, 3);
611 TREE_COMPLEXITY ($$) = current_class_depth;
613 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
618 typed_declspecs declarator
620 split_specs_attrs ($1.t, &specs, &attrs);
621 if (! start_function (specs, $2, attrs, 0))
623 reinit_parse_for_function ();
625 | declmods notype_declarator
627 split_specs_attrs ($1, &specs, &attrs);
628 if (! start_function (specs, $2, attrs, 0))
630 reinit_parse_for_function ();
633 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
635 reinit_parse_for_function ();
637 | declmods constructor_declarator
639 split_specs_attrs ($1, &specs, &attrs);
640 if (! start_function (specs, $2, attrs, 0))
642 reinit_parse_for_function ();
644 | constructor_declarator
645 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
647 reinit_parse_for_function ();
651 component_constructor_declarator:
652 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
653 { $$ = make_call_declarator ($1, $3, $5, $6); }
654 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
655 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
656 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
657 { $$ = make_call_declarator ($1, $3, $5, $6); }
658 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
659 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
662 /* more C++ complexity. See component_decl for a comment on the
663 reduce/reduce conflict introduced by these rules. */
665 declmods component_constructor_declarator
666 { tree specs = strip_attrs ($1);
667 $$ = start_method (specs, $2);
671 if (yychar == YYEMPTY)
673 reinit_parse_for_method (yychar, $$); }
674 | component_constructor_declarator
675 { $$ = start_method (NULL_TREE, $1); goto rest_of_mdef; }
676 | typed_declspecs declarator
677 { tree specs = strip_attrs ($1.t);
678 $$ = start_method (specs, $2); goto rest_of_mdef; }
679 | declmods notype_declarator
680 { tree specs = strip_attrs ($1);
681 $$ = start_method (specs, $2); goto rest_of_mdef; }
683 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
684 | declmods constructor_declarator
685 { tree specs = strip_attrs ($1);
686 $$ = start_method (specs, $2); goto rest_of_mdef; }
687 | constructor_declarator
688 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
694 if (! current_function_parms_stored)
702 { store_return_init ($<ttype>$, $2); }
703 | return_id '(' nonnull_exprlist ')'
704 { store_return_init ($<ttype>$, $3); }
705 | return_id LEFT_RIGHT
706 { store_return_init ($<ttype>$, NULL_TREE); }
710 ':' .set_base_init member_init_list
713 error ("no base initializers given following ':'");
715 /* Always keep the BLOCK node associated with the outermost
716 pair of curley braces of a function. These are needed
717 for correct operation of dwarfout.c. */
725 if (! current_function_parms_stored)
728 if (DECL_CONSTRUCTOR_P (current_function_decl))
730 /* Make a contour for the initializer list. */
733 expand_start_bindings (0);
735 else if (current_class_type == NULL_TREE)
736 error ("base initializers not allowed for non-member functions");
737 else if (! DECL_CONSTRUCTOR_P (current_function_decl))
738 error ("only constructors take base initializers");
747 | member_init_list ',' member_init
748 | member_init_list error
752 '(' nonnull_exprlist ')'
754 if (current_class_name)
755 pedwarn ("anachronistic old style base class initializer");
756 expand_member_init (current_class_ref, NULL_TREE, $2);
760 if (current_class_name)
761 pedwarn ("anachronistic old style base class initializer");
762 expand_member_init (current_class_ref, NULL_TREE, void_type_node);
764 | notype_identifier '(' nonnull_exprlist ')'
765 { expand_member_init (current_class_ref, $1, $3); }
766 | notype_identifier LEFT_RIGHT
767 { expand_member_init (current_class_ref, $1, void_type_node); }
768 | complete_type_name '(' nonnull_exprlist ')'
769 { expand_member_init (current_class_ref, $1, $3); }
770 | complete_type_name LEFT_RIGHT
771 { expand_member_init (current_class_ref, $1, void_type_node); }
773 | notype_qualified_id '(' nonnull_exprlist ')'
775 do_member_init (OP0 ($1), OP1 ($1), $3);
777 | notype_qualified_id LEFT_RIGHT
779 do_member_init (OP0 ($1), OP1 ($1), void_type_node);
803 explicit_instantiation:
804 TEMPLATE aggr template_type
805 { do_type_instantiation ($3, NULL_TREE); }
806 | TEMPLATE typed_declspecs declarator
807 { tree specs = strip_attrs ($2.t);
808 do_function_instantiation (specs, $3, NULL_TREE); }
809 | TEMPLATE notype_declarator
810 { do_function_instantiation (NULL_TREE, $2, NULL_TREE); }
811 | TEMPLATE constructor_declarator
812 { do_function_instantiation (NULL_TREE, $2, NULL_TREE); }
813 | SCSPEC TEMPLATE aggr template_type
814 { do_type_instantiation ($4, $1); }
815 | SCSPEC TEMPLATE typed_declspecs declarator
816 { tree specs = strip_attrs ($3.t);
817 do_function_instantiation (specs, $4, $1); }
818 | SCSPEC TEMPLATE notype_declarator
819 { do_function_instantiation (NULL_TREE, $3, $1); }
820 | SCSPEC TEMPLATE constructor_declarator
821 { do_function_instantiation (NULL_TREE, $3, $1); }
824 /* The TYPENAME expansions are to deal with use of a template class name as
825 a template within the class itself, where the template decl is hidden by
826 a type decl. Got all that? */
829 PTYPENAME '<' template_arg_list template_close_bracket
831 $$ = lookup_template_class ($1, $3, NULL_TREE);
832 if ($$ != error_mark_node)
833 $$ = TYPE_STUB_DECL ($$);
835 | PTYPENAME '<' template_close_bracket
837 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
838 if ($$ != error_mark_node)
839 $$ = TYPE_STUB_DECL ($$);
841 | TYPENAME '<' template_arg_list template_close_bracket
843 $$ = lookup_template_class ($1, $3, NULL_TREE);
844 if ($$ != error_mark_node)
845 $$ = TYPE_STUB_DECL ($$);
847 | TYPENAME '<' template_close_bracket
849 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
850 if ($$ != error_mark_node)
851 $$ = TYPE_STUB_DECL ($$);
857 SELFNAME '<' template_arg_list template_close_bracket
859 $$ = lookup_template_class ($1, $3, NULL_TREE);
860 if ($$ != error_mark_node)
861 $$ = TYPE_STUB_DECL ($$);
863 | SELFNAME '<' template_close_bracket
865 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
866 if ($$ != error_mark_node)
867 $$ = TYPE_STUB_DECL ($$);
871 template_close_bracket:
875 /* Handle `Class<Class<Type>>' without space in the `>>' */
876 pedwarn ("`>>' should be `> >' in template class name");
883 { $$ = build_tree_list (NULL_TREE, $$); }
884 | template_arg_list ',' template_arg
885 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
890 { $$ = groktypename ($1.t); }
891 | expr_no_commas %prec ARITHCOMPARE
896 { $$ = NEGATE_EXPR; }
898 { $$ = CONVERT_EXPR; }
900 { $$ = PREINCREMENT_EXPR; }
902 { $$ = PREDECREMENT_EXPR; }
904 { $$ = TRUTH_NOT_EXPR; }
909 { $$ = build_x_compound_expr ($$); }
915 { error ("ANSI C++ forbids an empty condition for `%s'",
917 $$ = integer_zero_node; }
919 { $$ = condition_conversion ($2); }
924 { error ("ANSI C++ forbids an empty condition for `%s'",
926 $$ = integer_zero_node; }
928 { $$ = condition_conversion ($2); }
935 { $$ = condition_conversion ($$); }
941 type_specifier_seq declarator maybeasm maybe_attribute '='
944 for (d = getdecls (); d; d = TREE_CHAIN (d))
945 if (TREE_CODE (d) == TYPE_DECL) {
946 tree s = TREE_TYPE (d);
947 if (TREE_CODE (s) == RECORD_TYPE)
948 cp_error ("definition of class `%T' in condition", s);
949 else if (TREE_CODE (s) == ENUMERAL_TYPE)
950 cp_error ("definition of enum `%T' in condition", s);
953 current_declspecs = $1.t;
954 $<itype>5 = suspend_momentary ();
955 $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1);
956 cplus_decl_attributes ($<ttype>$, $4,
957 /*prefix_attributes*/ NULL_TREE);
961 cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
962 resume_momentary ($<itype>5);
964 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
965 cp_error ("definition of array `%#D' in condition", $$);
972 | maybe_label_decls stmts '}'
973 | maybe_label_decls stmts error '}'
974 | maybe_label_decls error '}'
980 if (processing_template_decl)
982 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
983 COMPOUND_STMT_NO_SCOPE ($<ttype>$) = 1;
984 add_tree ($<ttype>$);
989 if (processing_template_decl)
991 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
992 TREE_CHAIN ($<ttype>2) = NULL_TREE;
993 last_tree = $<ttype>2;
1001 nontrivial_exprlist:
1002 expr_no_commas ',' expr_no_commas
1003 { $$ = tree_cons (NULL_TREE, $$,
1004 build_tree_list (NULL_TREE, $3)); }
1005 | expr_no_commas ',' error
1006 { $$ = tree_cons (NULL_TREE, $$,
1007 build_tree_list (NULL_TREE, error_mark_node)); }
1008 | nontrivial_exprlist ',' expr_no_commas
1009 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1010 | nontrivial_exprlist ',' error
1011 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1016 { $$ = build_tree_list (NULL_TREE, $$); }
1017 | nontrivial_exprlist
1023 /* __extension__ turns off -pedantic for following primary. */
1025 { $<itype>1 = pedantic;
1027 cast_expr %prec UNARY
1029 pedantic = $<itype>1; }
1030 | '*' cast_expr %prec UNARY
1031 { $$ = build_x_indirect_ref ($2, "unary *"); }
1032 | '&' cast_expr %prec UNARY
1033 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1035 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1036 | unop cast_expr %prec UNARY
1037 { $$ = build_x_unary_op ($1, $2);
1038 if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
1039 TREE_NEGATED_INT ($$) = 1;
1040 overflow_warning ($$);
1042 /* Refer to the address of a label as a pointer. */
1044 { tree label = lookup_label ($2);
1045 if (label == NULL_TREE)
1046 $$ = null_pointer_node;
1049 TREE_USED (label) = 1;
1050 $$ = build1 (ADDR_EXPR, ptr_type_node, label);
1051 TREE_CONSTANT ($$) = 1;
1054 | SIZEOF unary_expr %prec UNARY
1055 { $$ = expr_sizeof ($2); }
1056 | SIZEOF '(' type_id ')' %prec HYPERUNARY
1057 { $$ = c_sizeof (groktypename ($3.t)); }
1058 | ALIGNOF unary_expr %prec UNARY
1059 { $$ = grok_alignof ($2); }
1060 | ALIGNOF '(' type_id ')' %prec HYPERUNARY
1061 { $$ = c_alignof (groktypename ($3.t));
1062 check_for_new_type ("alignof", $3); }
1064 /* The %prec EMPTY's here are required by the = init initializer
1065 syntax extension; see below. */
1066 | new new_type_id %prec EMPTY
1067 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1068 check_for_new_type ("new", $2); }
1069 | new new_type_id new_initializer
1070 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1071 check_for_new_type ("new", $2); }
1072 | new new_placement new_type_id %prec EMPTY
1073 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1074 check_for_new_type ("new", $3); }
1075 | new new_placement new_type_id new_initializer
1076 { $$ = build_new ($2, $3.t, $4, $1);
1077 check_for_new_type ("new", $3); }
1078 | new '(' type_id ')' %prec EMPTY
1079 { $$ = build_new (NULL_TREE, groktypename($3.t),
1081 check_for_new_type ("new", $3); }
1082 | new '(' type_id ')' new_initializer
1083 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1084 check_for_new_type ("new", $3); }
1085 | new new_placement '(' type_id ')' %prec EMPTY
1086 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1087 check_for_new_type ("new", $4); }
1088 | new new_placement '(' type_id ')' new_initializer
1089 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1090 check_for_new_type ("new", $4); }
1092 | delete cast_expr %prec UNARY
1093 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1094 | delete '[' ']' cast_expr %prec UNARY
1095 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1096 if (yychar == YYEMPTY)
1098 | delete '[' expr ']' cast_expr %prec UNARY
1099 { $$ = delete_sanity ($5, $3, 2, $1);
1100 if (yychar == YYEMPTY)
1105 '(' nonnull_exprlist ')'
1107 | '{' nonnull_exprlist '}'
1110 pedwarn ("old style placement syntax, use () instead");
1115 '(' nonnull_exprlist ')'
1121 cp_error ("`%T' is not a valid expression", $2.t);
1122 $$ = error_mark_node;
1124 /* GNU extension so people can use initializer lists. Note that
1125 this alters the meaning of `new int = 1', which was previously
1126 syntactically valid but semantically invalid. */
1130 pedwarn ("ANSI C++ forbids initialization of new expression with `='");
1135 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1137 '(' type_id ')' %prec EMPTY
1138 { $2.t = tree_cons (NULL_TREE, $2.t, void_list_node);
1139 TREE_PARMLIST ($2.t) = 1;
1140 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1141 check_for_new_type ("cast", $2); }
1142 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1143 { $3.t = tree_cons (NULL_TREE, $3.t, void_list_node);
1144 TREE_PARMLIST ($3.t) = 1;
1145 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1146 check_for_new_type ("cast", $3); }
1151 | regcast_or_absdcl unary_expr %prec UNARY
1152 { $$ = reparse_absdcl_as_casts ($$, $2); }
1153 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1155 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1158 pedwarn ("ANSI C++ forbids constructor-expressions");
1159 /* Indicate that this was a GNU C constructor expression. */
1160 TREE_HAS_CONSTRUCTOR (init) = 1;
1162 $$ = reparse_absdcl_as_casts ($$, init);
1168 /* Handle general members. */
1169 | expr_no_commas POINTSAT_STAR expr_no_commas
1170 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1171 | expr_no_commas DOT_STAR expr_no_commas
1172 { $$ = build_m_component_ref ($$, $3); }
1173 | expr_no_commas '+' expr_no_commas
1174 { $$ = build_x_binary_op ($2, $$, $3); }
1175 | expr_no_commas '-' expr_no_commas
1176 { $$ = build_x_binary_op ($2, $$, $3); }
1177 | expr_no_commas '*' expr_no_commas
1178 { $$ = build_x_binary_op ($2, $$, $3); }
1179 | expr_no_commas '/' expr_no_commas
1180 { $$ = build_x_binary_op ($2, $$, $3); }
1181 | expr_no_commas '%' expr_no_commas
1182 { $$ = build_x_binary_op ($2, $$, $3); }
1183 | expr_no_commas LSHIFT expr_no_commas
1184 { $$ = build_x_binary_op ($2, $$, $3); }
1185 | expr_no_commas RSHIFT expr_no_commas
1186 { $$ = build_x_binary_op ($2, $$, $3); }
1187 | expr_no_commas ARITHCOMPARE expr_no_commas
1188 { $$ = build_x_binary_op ($2, $$, $3); }
1189 | expr_no_commas '<' expr_no_commas
1190 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1191 | expr_no_commas '>' expr_no_commas
1192 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1193 | expr_no_commas EQCOMPARE expr_no_commas
1194 { $$ = build_x_binary_op ($2, $$, $3); }
1195 | expr_no_commas MIN_MAX expr_no_commas
1196 { $$ = build_x_binary_op ($2, $$, $3); }
1197 | expr_no_commas '&' expr_no_commas
1198 { $$ = build_x_binary_op ($2, $$, $3); }
1199 | expr_no_commas '|' expr_no_commas
1200 { $$ = build_x_binary_op ($2, $$, $3); }
1201 | expr_no_commas '^' expr_no_commas
1202 { $$ = build_x_binary_op ($2, $$, $3); }
1203 | expr_no_commas ANDAND expr_no_commas
1204 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1205 | expr_no_commas OROR expr_no_commas
1206 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1207 | expr_no_commas '?' xexpr ':' expr_no_commas
1208 { $$ = build_x_conditional_expr ($$, $3, $5); }
1209 | expr_no_commas '=' expr_no_commas
1210 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1211 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1212 | expr_no_commas ASSIGN expr_no_commas
1213 { $$ = build_x_modify_expr ($$, $2, $3); }
1215 { $$ = build_throw (NULL_TREE); }
1216 | THROW expr_no_commas
1217 { $$ = build_throw ($2); }
1218 /* These extensions are not defined. The second arg to build_m_component_ref
1219 is old, build_m_component_ref now does an implicit
1220 build_indirect_ref (x, NULL_PTR) on the second argument.
1221 | object '&' expr_no_commas %prec UNARY
1222 { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
1223 | object unop expr_no_commas %prec UNARY
1224 { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
1225 | object '(' type_id ')' expr_no_commas %prec UNARY
1226 { tree type = groktypename ($3.t);
1227 $$ = build_m_component_ref ($$, build_c_cast (type, $5, 0)); }
1228 | object primary_no_id %prec UNARY
1229 { $$ = build_m_component_ref ($$, $2); }
1233 notype_unqualified_id:
1234 '~' see_typename identifier
1235 { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
1239 | NSNAME %prec EMPTY
1243 notype_unqualified_id
1249 notype_unqualified_id
1250 | '*' expr_or_declarator %prec UNARY
1251 { $$ = build_parse_node (INDIRECT_REF, $2); }
1252 | '&' expr_or_declarator %prec UNARY
1253 { $$ = build_parse_node (ADDR_EXPR, $2); }
1254 | '(' expr_or_declarator ')'
1258 direct_notype_declarator:
1259 complex_direct_notype_declarator
1260 | notype_unqualified_id
1261 | '(' expr_or_declarator ')'
1262 { $$ = finish_decl_parsing ($2); }
1266 notype_unqualified_id
1268 if (TREE_CODE ($$) == BIT_NOT_EXPR)
1269 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
1271 $$ = do_identifier ($$, 1);
1277 if (processing_template_decl)
1278 push_obstacks (&permanent_obstack, &permanent_obstack);
1279 $$ = combine_strings ($$);
1280 if (processing_template_decl)
1286 class = TREE_CODE_CLASS (TREE_CODE ($$));
1287 if (class == 'e' || class == '1'
1288 || class == '2' || class == '<')
1289 /* This inhibits warnings in truthvalue_conversion. */
1290 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1291 | '(' expr_or_declarator ')'
1293 $$ = reparse_decl_as_expr (NULL_TREE, $2);
1294 class = TREE_CODE_CLASS (TREE_CODE ($$));
1295 if (class == 'e' || class == '1'
1296 || class == '2' || class == '<')
1297 /* This inhibits warnings in truthvalue_conversion. */
1298 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1300 { $$ = error_mark_node; }
1302 { if (current_function_decl == 0)
1304 error ("braced-group within expression allowed only inside a function");
1308 $<ttype>$ = expand_start_stmt_expr (); }
1312 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1313 rtl_exp = expand_end_stmt_expr ($<ttype>2);
1314 /* The statements have side effects, so the group does. */
1315 TREE_SIDE_EFFECTS (rtl_exp) = 1;
1317 if (TREE_CODE ($3) == BLOCK)
1319 /* Make a BIND_EXPR for the BLOCK already made. */
1320 $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
1321 NULL_TREE, rtl_exp, $3);
1322 /* Remove the block from the tree at this point.
1323 It gets put back at the proper place
1324 when the BIND_EXPR is expanded. */
1330 | primary '(' nonnull_exprlist ')'
1332 $$ = build_x_function_call ($1, $3, current_class_ref);
1333 if (TREE_CODE ($$) == CALL_EXPR
1334 && TREE_TYPE ($$) != void_type_node)
1335 $$ = require_complete_type ($$);
1337 | primary LEFT_RIGHT
1339 $$ = build_x_function_call ($$, NULL_TREE, current_class_ref);
1340 if (TREE_CODE ($$) == CALL_EXPR
1341 && TREE_TYPE ($$) != void_type_node)
1342 $$ = require_complete_type ($$);
1344 | primary '[' expr ']'
1345 { $$ = grok_array_decl ($$, $3); }
1347 { /* If we get an OFFSET_REF, turn it into what it really
1348 means (e.g., a COMPONENT_REF). This way if we've got,
1349 say, a reference to a static member that's being operated
1350 on, we don't end up trying to find a member operator for
1351 the class it's in. */
1352 if (TREE_CODE ($$) == OFFSET_REF)
1353 $$ = resolve_offset_ref ($$);
1354 $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1355 | primary MINUSMINUS
1356 { if (TREE_CODE ($$) == OFFSET_REF)
1357 $$ = resolve_offset_ref ($$);
1358 $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1359 /* C++ extensions */
1361 { if (current_class_ptr)
1363 #ifdef WARNING_ABOUT_CCD
1364 TREE_USED (current_class_ptr) = 1;
1366 $$ = current_class_ptr;
1368 else if (current_function_decl
1369 && DECL_STATIC_FUNCTION_P (current_function_decl))
1371 error ("`this' is unavailable for static member functions");
1372 $$ = error_mark_node;
1376 if (current_function_decl)
1377 error ("invalid use of `this' in non-member function");
1379 error ("invalid use of `this' at top level");
1380 $$ = error_mark_node;
1383 | CV_QUALIFIER '(' nonnull_exprlist ')'
1388 /* This is a C cast in C++'s `functional' notation. */
1389 if ($3 == error_mark_node)
1391 $$ = error_mark_node;
1395 if ($3 == NULL_TREE)
1397 error ("cannot cast null list to type `%s'",
1398 IDENTIFIER_POINTER (TYPE_NAME (id)));
1399 $$ = error_mark_node;
1404 /* type is not set! (mrs) */
1405 if (type == error_mark_node)
1406 $$ = error_mark_node;
1410 if (id == ridpointers[(int) RID_CONST])
1411 type = build_type_variant (integer_type_node, 1, 0);
1412 else if (id == ridpointers[(int) RID_VOLATILE])
1413 type = build_type_variant (integer_type_node, 0, 1);
1415 /* should not be able to get here (mrs) */
1416 else if (id == ridpointers[(int) RID_FRIEND])
1418 error ("cannot cast expression to `friend' type");
1419 $$ = error_mark_node;
1423 else my_friendly_abort (79);
1424 $$ = build_c_cast (type, build_compound_expr ($3), 1);
1428 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1429 { tree type = groktypename ($3.t);
1430 check_for_new_type ("dynamic_cast", $3);
1431 $$ = build_dynamic_cast (type, $6); }
1432 | STATIC_CAST '<' type_id '>' '(' expr ')'
1433 { tree type = groktypename ($3.t);
1434 check_for_new_type ("static_cast", $3);
1435 $$ = build_static_cast (type, $6); }
1436 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1437 { tree type = groktypename ($3.t);
1438 check_for_new_type ("reinterpret_cast", $3);
1439 $$ = build_reinterpret_cast (type, $6); }
1440 | CONST_CAST '<' type_id '>' '(' expr ')'
1441 { tree type = groktypename ($3.t);
1442 check_for_new_type ("const_cast", $3);
1443 $$ = build_const_cast (type, $6); }
1444 | TYPEID '(' expr ')'
1445 { $$ = build_x_typeid ($3); }
1446 | TYPEID '(' type_id ')'
1447 { tree type = groktypename ($3.t);
1448 check_for_new_type ("typeid", $3);
1449 $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
1450 | global_scope IDENTIFIER
1451 { $$ = do_scoped_id ($2, 1); }
1452 | global_scope operator_name
1454 got_scope = NULL_TREE;
1455 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1456 $$ = do_scoped_id ($2, 1);
1460 | overqualified_id %prec HYPERUNARY
1461 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1462 | overqualified_id '(' nonnull_exprlist ')'
1463 { if (processing_template_decl)
1464 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, NULL_TREE);
1466 $$ = build_member_call (OP0 ($$), OP1 ($$), $3); }
1467 | overqualified_id LEFT_RIGHT
1468 { if (processing_template_decl)
1469 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1),
1470 NULL_TREE, NULL_TREE);
1472 $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); }
1473 | object unqualified_id %prec UNARY
1474 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1475 | object overqualified_id %prec UNARY
1476 { if (processing_template_decl)
1477 $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
1479 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1480 | object unqualified_id '(' nonnull_exprlist ')'
1483 /* This is a future direction of this code, but because
1484 build_x_function_call cannot always undo what is done
1485 in build_component_ref entirely yet, we cannot do this. */
1486 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, current_class_ref);
1487 if (TREE_CODE ($$) == CALL_EXPR
1488 && TREE_TYPE ($$) != void_type_node)
1489 $$ = require_complete_type ($$);
1491 $$ = build_method_call ($$, $2, $4, NULL_TREE,
1495 | object unqualified_id LEFT_RIGHT
1498 /* This is a future direction of this code, but because
1499 build_x_function_call cannot always undo what is done
1500 in build_component_ref entirely yet, we cannot do this. */
1501 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, current_class_ref);
1502 if (TREE_CODE ($$) == CALL_EXPR
1503 && TREE_TYPE ($$) != void_type_node)
1504 $$ = require_complete_type ($$);
1506 $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
1510 | object overqualified_id '(' nonnull_exprlist ')'
1512 if (IS_SIGNATURE (OP0 ($2)))
1514 warning ("signature name in scope resolution ignored");
1515 $$ = build_method_call ($$, OP1 ($2), $4, NULL_TREE,
1519 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
1521 | object overqualified_id LEFT_RIGHT
1523 if (IS_SIGNATURE (OP0 ($2)))
1525 warning ("signature name in scope resolution ignored");
1526 $$ = build_method_call ($$, OP1 ($2), NULL_TREE, NULL_TREE,
1530 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), NULL_TREE);
1532 /* p->int::~int() is valid -- 12.4 */
1533 | object '~' TYPESPEC LEFT_RIGHT
1535 if (IDENTIFIER_GLOBAL_VALUE ($3)
1536 && (TREE_CODE (TREE_TYPE ($1))
1537 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
1538 cp_error ("`%E' is not of type `%T'", $1, $3);
1539 $$ = convert (void_type_node, $1);
1541 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1544 cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
1545 if (TREE_CODE (TREE_TYPE ($1))
1546 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
1547 cp_error ("`%E' is not of type `%T'", $1, $2);
1548 $$ = convert (void_type_node, $1);
1552 $$ = error_mark_node;
1556 /* Not needed for now.
1562 { $$ = error_mark_node; }
1564 { if (current_function_decl == 0)
1566 error ("braced-group within expression allowed only inside a function");
1569 $<ttype>$ = expand_start_stmt_expr (); }
1572 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1573 $$ = expand_end_stmt_expr ($<ttype>2); }
1574 | primary_no_id '(' nonnull_exprlist ')'
1575 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1576 | primary_no_id LEFT_RIGHT
1577 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1578 | primary_no_id '[' expr ']'
1580 | primary_no_id PLUSPLUS
1581 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1582 | primary_no_id MINUSMINUS
1583 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1585 { goto do_scoped_id; }
1586 | SCOPE operator_name
1587 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1589 goto do_scoped_operator;
1598 { got_scope = NULL_TREE; $$ = 1; }
1604 | global_scope delete
1605 { got_scope = NULL_TREE; $$ = 1; }
1610 { $$ = boolean_true_node; }
1612 { $$ = boolean_false_node; }
1615 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1619 { $$ = chainon ($$, $2); }
1625 if (! current_function_parms_stored)
1626 store_parm_decls ();
1628 /* Always keep the BLOCK node associated with the outermost
1629 pair of curley braces of a function. These are needed
1630 for correct operation of dwarfout.c. */
1637 { got_object = TREE_TYPE ($$); }
1640 $$ = build_x_arrow ($$);
1641 got_object = TREE_TYPE ($$);
1646 typespec initdecls ';'
1648 resume_momentary ($2);
1649 if (IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1650 note_got_semicolon ($1.t);
1652 | typed_declspecs initdecls ';'
1654 resume_momentary ($2);
1655 note_list_got_semicolon ($1.t);
1657 | declmods notype_initdecls ';'
1658 { resume_momentary ($2); }
1659 | typed_declspecs ';'
1662 note_list_got_semicolon ($1.t);
1665 { warning ("empty declaration"); }
1668 /* Any kind of declarator (thus, all declarators allowed
1669 after an explicit typespec). */
1672 after_type_declarator %prec EMPTY
1673 | notype_declarator %prec EMPTY
1676 /* This is necessary to postpone reduction of `int()()()()'. */
1678 LEFT_RIGHT %prec EMPTY
1679 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1680 NULL_TREE, NULL_TREE); }
1681 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1682 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1686 /* ANSI type-id (8.1) */
1688 typed_typespecs absdcl
1689 { $$.t = build_decl_list ($1.t, $2);
1690 $$.new_type_flag = $1.new_type_flag; }
1691 | nonempty_cv_qualifiers absdcl
1692 { $$.t = build_decl_list ($1.t, $2);
1693 $$.new_type_flag = $1.new_type_flag; }
1695 { $$.t = build_decl_list (get_decl_list ($1.t), $2);
1696 $$.new_type_flag = $1.new_type_flag; }
1697 | typed_typespecs %prec EMPTY
1698 { $$.t = build_decl_list ($1.t, NULL_TREE);
1699 $$.new_type_flag = $1.new_type_flag; }
1700 | nonempty_cv_qualifiers %prec EMPTY
1701 { $$.t = build_decl_list ($1.t, NULL_TREE);
1702 $$.new_type_flag = $1.new_type_flag; }
1705 /* Declspecs which contain at least one type specifier or typedef name.
1706 (Just `const' or `volatile' is not enough.)
1707 A typedef'd name following these is taken as a name to be declared.
1708 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1711 typed_typespecs %prec EMPTY
1717 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1);
1718 $$.new_type_flag = $2.new_type_flag; }
1719 | typespec reserved_declspecs %prec HYPERUNARY
1720 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1721 $$.new_type_flag = $1.new_type_flag; }
1722 | typespec reserved_typespecquals reserved_declspecs
1723 { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1724 $$.new_type_flag = $1.new_type_flag; }
1725 | declmods typespec reserved_declspecs
1726 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1727 $$.new_type_flag = $2.new_type_flag; }
1728 | declmods typespec reserved_typespecquals
1729 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1730 $$.new_type_flag = $2.new_type_flag; }
1731 | declmods typespec reserved_typespecquals reserved_declspecs
1732 { $$.t = decl_tree_cons (NULL_TREE, $2.t,
1733 chainon ($3, chainon ($4, $1)));
1734 $$.new_type_flag = $2.new_type_flag; }
1739 { if (extra_warnings)
1740 warning ("`%s' is not at beginning of declaration",
1741 IDENTIFIER_POINTER ($$));
1742 $$ = build_decl_list (NULL_TREE, $$); }
1743 | reserved_declspecs typespecqual_reserved
1744 { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
1745 | reserved_declspecs SCSPEC
1746 { if (extra_warnings)
1747 warning ("`%s' is not at beginning of declaration",
1748 IDENTIFIER_POINTER ($2));
1749 $$ = decl_tree_cons (NULL_TREE, $2, $$); }
1750 | reserved_declspecs attributes
1751 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1753 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1756 /* List of just storage classes and type modifiers.
1757 A declaration can start with just this, but then it cannot be used
1758 to redeclare a typedef-name.
1759 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1762 nonempty_cv_qualifiers %prec EMPTY
1763 { $$ = $1.t; TREE_STATIC ($$) = 1; }
1765 { $$ = IDENTIFIER_AS_LIST ($$); }
1766 | declmods CV_QUALIFIER
1767 { $$ = decl_tree_cons (NULL_TREE, $2, $$);
1768 TREE_STATIC ($$) = 1; }
1770 { if (extra_warnings && TREE_STATIC ($$))
1771 warning ("`%s' is not at beginning of declaration",
1772 IDENTIFIER_POINTER ($2));
1773 $$ = decl_tree_cons (NULL_TREE, $2, $$);
1774 TREE_STATIC ($$) = TREE_STATIC ($1); }
1775 | declmods attributes
1776 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1778 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1781 /* Used instead of declspecs where storage classes are not allowed
1782 (that is, for typenames and structure components).
1784 C++ can takes storage classes for structure components.
1785 Don't accept a typedef-name if anything but a modifier precedes it. */
1788 typespec %prec EMPTY
1789 { $$.t = get_decl_list ($1.t);
1790 $$.new_type_flag = $1.new_type_flag; }
1791 | nonempty_cv_qualifiers typespec
1792 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
1793 $$.new_type_flag = $2.new_type_flag; }
1794 | typespec reserved_typespecquals
1795 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1796 $$.new_type_flag = $1.new_type_flag; }
1797 | nonempty_cv_qualifiers typespec reserved_typespecquals
1798 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1799 $$.new_type_flag = $1.new_type_flag; }
1802 reserved_typespecquals:
1803 typespecqual_reserved
1804 { $$ = build_decl_list (NULL_TREE, $1.t); }
1805 | reserved_typespecquals typespecqual_reserved
1806 { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
1809 /* A typespec (but not a type qualifier).
1810 Once we have seen one of these in a declaration,
1811 if a typedef name appears then it is being redeclared. */
1815 | TYPESPEC %prec EMPTY
1816 { $$.t = $1; $$.new_type_flag = 0; }
1817 | complete_type_name
1818 { $$.t = $1; $$.new_type_flag = 0; }
1819 | TYPEOF '(' expr ')'
1820 { $$.t = TREE_TYPE ($3);
1821 $$.new_type_flag = 0;
1822 if (pedantic && !in_system_header)
1823 pedwarn ("ANSI C++ forbids `typeof'"); }
1824 | TYPEOF '(' type_id ')'
1825 { $$.t = groktypename ($3.t);
1826 if (pedantic && !in_system_header)
1827 pedwarn ("ANSI C++ forbids `typeof'");
1828 $$.new_type_flag = 0; }
1829 | SIGOF '(' expr ')'
1830 { tree type = TREE_TYPE ($3);
1832 $$.new_type_flag = 0;
1833 if (IS_AGGR_TYPE (type))
1835 sorry ("sigof type specifier");
1840 error ("`sigof' applied to non-aggregate expression");
1841 $$.t = error_mark_node;
1844 | SIGOF '(' type_id ')'
1845 { tree type = groktypename ($3.t);
1847 $$.new_type_flag = 0;
1848 if (IS_AGGR_TYPE (type))
1850 sorry ("sigof type specifier");
1855 error("`sigof' applied to non-aggregate type");
1856 $$.t = error_mark_node;
1861 /* A typespec that is a reserved word, or a type qualifier. */
1863 typespecqual_reserved:
1865 { $$.t = $1; $$.new_type_flag = 0; }
1867 { $$.t = $1; $$.new_type_flag = 0; }
1873 | initdecls ',' initdcl
1878 | notype_initdecls ',' initdcl
1883 | nomods_initdecls ',' initdcl
1889 | asm_keyword '(' string ')'
1890 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
1894 declarator maybeasm maybe_attribute '='
1895 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1896 &prefix_attributes);
1897 if (TREE_CODE (current_declspecs) != TREE_LIST)
1898 current_declspecs = get_decl_list (current_declspecs);
1899 if (have_extern_spec && !used_extern_spec)
1901 current_declspecs = decl_tree_cons
1902 (NULL_TREE, get_identifier ("extern"),
1904 used_extern_spec = 1;
1906 $<itype>4 = suspend_momentary ();
1907 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1908 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1910 /* Note how the declaration of the variable is in effect while its init is parsed! */
1911 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1913 | declarator maybeasm maybe_attribute
1915 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1916 &prefix_attributes);
1917 if (TREE_CODE (current_declspecs) != TREE_LIST)
1918 current_declspecs = get_decl_list (current_declspecs);
1919 if (have_extern_spec && !used_extern_spec)
1921 current_declspecs = decl_tree_cons
1922 (NULL_TREE, get_identifier ("extern"),
1924 used_extern_spec = 1;
1926 $$ = suspend_momentary ();
1927 d = start_decl ($<ttype>1, current_declspecs, 0);
1928 cplus_decl_attributes (d, $3, prefix_attributes);
1929 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1933 declarator maybeasm maybe_attribute '='
1934 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1935 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1937 /* Note how the declaration of the variable is in effect while its init is parsed! */
1938 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING); }
1939 | declarator maybeasm maybe_attribute
1940 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0);
1941 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes);
1942 cp_finish_decl ($<ttype>$, NULL_TREE, $2, 1, 0); }
1946 notype_declarator maybeasm maybe_attribute '='
1947 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1948 &prefix_attributes);
1949 $<itype>4 = suspend_momentary ();
1950 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1951 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1953 /* Note how the declaration of the variable is in effect while its init is parsed! */
1954 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1956 | notype_declarator maybeasm maybe_attribute
1958 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1959 &prefix_attributes);
1960 $$ = suspend_momentary ();
1961 d = start_decl ($<ttype>1, current_declspecs, 0);
1962 cplus_decl_attributes (d, $3, prefix_attributes);
1963 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1967 notype_declarator maybeasm maybe_attribute '='
1968 { current_declspecs = NULL_TREE;
1969 prefix_attributes = NULL_TREE;
1970 $<itype>4 = suspend_momentary ();
1971 $<ttype>$ = start_decl ($1, current_declspecs, 1);
1972 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1974 /* Note how the declaration of the variable is in effect while its init is parsed! */
1975 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1977 | notype_declarator maybeasm maybe_attribute
1979 current_declspecs = NULL_TREE;
1980 prefix_attributes = NULL_TREE;
1981 $$ = suspend_momentary ();
1982 d = start_decl ($1, current_declspecs, 0);
1983 cplus_decl_attributes (d, $3, prefix_attributes);
1984 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1987 /* the * rules are dummies to accept the Apollo extended syntax
1988 so that the header files compile. */
1999 | attributes attribute
2000 { $$ = chainon ($1, $2); }
2004 ATTRIBUTE '(' '(' attribute_list ')' ')'
2011 | attribute_list ',' attrib
2012 { $$ = chainon ($1, $3); }
2019 { $$ = build_tree_list ($1, NULL_TREE); }
2020 | any_word '(' IDENTIFIER ')'
2021 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2022 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2023 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2024 | any_word '(' nonnull_exprlist ')'
2025 { $$ = build_tree_list ($1, $3); }
2028 /* This still leaves out most reserved keywords,
2029 shouldn't we include them? */
2038 /* A nonempty list of identifiers, including typenames. */
2039 identifiers_or_typenames:
2041 { $$ = build_tree_list (NULL_TREE, $1); }
2042 | identifiers_or_typenames ',' identifier
2043 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2047 /* empty */ %prec EMPTY
2052 /* If we are processing a template, we don't want to expand this
2056 expr_no_commas %prec '='
2058 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2059 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2061 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2062 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2063 | '{' initlist ',' '}'
2064 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2065 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2070 /* This chain is built in reverse order,
2071 and put in forward order where initlist is used. */
2074 { $$ = build_tree_list (NULL_TREE, $$); }
2076 { $$ = tree_cons (NULL_TREE, $3, $$); }
2077 /* These are for labeled elements. */
2078 | '[' expr_no_commas ']' init
2079 { $$ = build_tree_list ($2, $4); }
2080 | initlist ',' CASE expr_no_commas ':' init
2081 { $$ = tree_cons ($4, $6, $$); }
2082 | identifier ':' init
2083 { $$ = build_tree_list ($$, $3); }
2084 | initlist ',' identifier ':' init
2085 { $$ = tree_cons ($3, $5, $$); }
2089 PRE_PARSED_FUNCTION_DECL
2090 { start_function (NULL_TREE, TREE_VALUE ($1),
2092 reinit_parse_for_function (); }
2096 | pending_inlines fn.defpen maybe_return_init ctor_initializer_opt
2099 int nested = (hack_decl_function_context
2100 (current_function_decl) != NULL_TREE);
2101 finish_function (lineno, (int)$4, nested);
2102 process_next_inline ($2);
2104 | pending_inlines fn.defpen maybe_return_init function_try_block
2105 { process_next_inline ($2); }
2111 { $<itype>3 = suspend_momentary ();
2112 $<ttype>$ = start_enum ($2); }
2113 enumlist maybecomma_warn '}'
2114 { $$.t = finish_enum ($<ttype>4, $5);
2115 $$.new_type_flag = 1;
2116 resume_momentary ((int) $<itype>3);
2117 check_for_missing_semicolon ($<ttype>4); }
2118 | ENUM identifier '{' '}'
2119 { $$.t = finish_enum (start_enum ($2), NULL_TREE);
2120 $$.new_type_flag = 1;
2121 check_for_missing_semicolon ($$.t); }
2123 { $<itype>2 = suspend_momentary ();
2124 $<ttype>$ = start_enum (make_anon_name ()); }
2125 enumlist maybecomma_warn '}'
2126 { $$.t = finish_enum ($<ttype>3, $4);
2127 resume_momentary ((int) $<itype>1);
2128 check_for_missing_semicolon ($<ttype>3);
2129 $$.new_type_flag = 1; }
2131 { $$.t = finish_enum (start_enum (make_anon_name()), NULL_TREE);
2132 $$.new_type_flag = 1;
2133 check_for_missing_semicolon ($$.t); }
2135 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2136 $$.new_type_flag = 0; }
2137 | ENUM complex_type_name
2138 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2139 $$.new_type_flag = 0; }
2140 | TYPENAME_KEYWORD nested_name_specifier identifier
2141 { $$.t = make_typename_type ($2, $3);
2142 $$.new_type_flag = 0; }
2143 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2144 { $$.t = make_typename_type ($3, $4);
2145 $$.new_type_flag = 0; }
2146 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2147 | class_head left_curly opt.component_decl_list '}' maybe_attribute
2154 /* Need to rework class nesting in the
2155 presence of nested classes, etc. */
2156 shadow_tag (CLASSTYPE_AS_LIST ($1)); */
2158 if (yychar == YYEMPTY)
2160 semi = yychar == ';';
2161 /* finish_struct nukes this anyway; if
2162 finish_exception does too, then it can go. */
2164 note_got_semicolon ($1);
2166 if (TREE_CODE ($1) == ENUMERAL_TYPE)
2170 $<ttype>$ = finish_struct ($1, $3, $5, semi);
2171 if (semi) note_got_semicolon ($<ttype>$);
2177 check_for_missing_semicolon ($1);
2179 && current_scope () == current_function_decl)
2180 do_pending_inlines ();
2184 $$.new_type_flag = 1; }
2185 | class_head %prec EMPTY
2188 $$.new_type_flag = 0;
2189 /* struct B: public A; is not accepted by the WP grammar. */
2190 if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
2191 && ! TYPE_BEING_DEFINED ($$.t))
2192 cp_error ("base clause without member specification for `%#T'",
2205 { if (pedantic && !in_system_header)
2206 pedwarn ("comma at end of enumerator list"); }
2212 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2214 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2216 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2218 { error ("no body nor ';' separates two class, struct or union declarations"); }
2221 named_class_head_sans_basetype:
2223 { current_aggr = $$; $$ = $2; }
2226 named_class_head_sans_basetype_defn:
2227 aggr identifier_defn %prec EMPTY
2228 { current_aggr = $$; $$ = $2; }
2231 named_complex_class_head_sans_basetype:
2232 aggr nested_name_specifier identifier
2235 if (TREE_CODE ($3) == TYPE_DECL)
2239 cp_error ("`%T' does not have a nested type named `%D'",
2242 (current_aggr, make_anon_name (), NULL_TREE, 1);
2243 $$ = TYPE_MAIN_DECL ($$);
2246 | aggr template_type
2247 { current_aggr = $$; $$ = $2; }
2248 | aggr nested_name_specifier template_type
2249 { current_aggr = $$; $$ = $3; }
2253 /* empty */ %prec EMPTY
2254 { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
2258 named_class_head_sans_basetype %prec EMPTY
2259 { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
2260 | named_class_head_sans_basetype_defn do_xref_defn
2261 maybe_base_class_list %prec EMPTY
2265 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2267 | named_complex_class_head_sans_basetype maybe_base_class_list
2269 $$ = TREE_TYPE ($1);
2270 if (TREE_INT_CST_LOW (current_aggr) == union_type
2271 && TREE_CODE ($$) != UNION_TYPE)
2272 cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
2273 else if (TREE_CODE ($$) == UNION_TYPE
2274 && TREE_INT_CST_LOW (current_aggr) != union_type)
2275 cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
2278 if (IS_AGGR_TYPE ($$) && CLASSTYPE_USE_TEMPLATE ($$))
2280 if (CLASSTYPE_IMPLICIT_INSTANTIATION ($$)
2281 && TYPE_SIZE ($$) == NULL_TREE)
2283 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION ($$);
2284 if (processing_template_decl)
2285 push_template_decl (TYPE_MAIN_DECL ($$));
2287 else if (CLASSTYPE_TEMPLATE_INSTANTIATION ($$))
2288 cp_error ("specialization after instantiation of `%T'", $$);
2290 xref_basetypes (current_aggr, $1, $$, $2);
2297 { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
2298 yyungetc ('{', 1); }
2306 maybe_base_class_list:
2307 /* empty */ %prec EMPTY
2309 | ':' see_typename %prec EMPTY
2310 { yyungetc(':', 1); $$ = NULL_TREE; }
2311 | ':' see_typename base_class_list %prec EMPTY
2317 | base_class_list ',' see_typename base_class
2318 { $$ = chainon ($$, $4); }
2324 tree type = TREE_TYPE ($1);
2325 if (! is_aggr_type (type, 1))
2327 else if (current_aggr == signature_type_node
2328 && (! type) && (! IS_SIGNATURE (type)))
2330 error ("class name not allowed as base signature");
2333 else if (current_aggr == signature_type_node)
2335 sorry ("signature inheritance, base type `%s' ignored",
2336 IDENTIFIER_POINTER ($$));
2337 $$ = build_tree_list (access_public_node, type);
2339 else if (type && IS_SIGNATURE (type))
2341 error ("signature name not allowed as base class");
2345 $$ = build_tree_list (access_default_node, type);
2347 | base_class_access_list see_typename base_class.1
2349 tree type = TREE_TYPE ($3);
2350 if (current_aggr == signature_type_node)
2351 error ("access and source specifiers not allowed in signature");
2352 if (! IS_AGGR_TYPE (type))
2354 else if (current_aggr == signature_type_node
2355 && (! type) && (! IS_SIGNATURE (type)))
2357 error ("class name not allowed as base signature");
2360 else if (current_aggr == signature_type_node)
2362 sorry ("signature inheritance, base type `%s' ignored",
2363 IDENTIFIER_POINTER ($$));
2364 $$ = build_tree_list (access_public_node, type);
2366 else if (type && IS_SIGNATURE (type))
2368 error ("signature name not allowed as base class");
2372 $$ = build_tree_list ($$, type);
2378 | TYPENAME_KEYWORD nested_name_specifier identifier
2379 { $$ = TYPE_MAIN_DECL (make_typename_type ($2, $3)); }
2380 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2381 { $$ = TYPE_MAIN_DECL (make_typename_type ($3, $4)); }
2382 | SIGOF '(' expr ')'
2384 if (current_aggr == signature_type_node)
2386 if (IS_AGGR_TYPE (TREE_TYPE ($3)))
2388 sorry ("`sigof' as base signature specifier");
2389 $$ = TREE_TYPE ($3);
2393 error ("`sigof' applied to non-aggregate expression");
2394 $$ = error_mark_node;
2399 error ("`sigof' in struct or class declaration");
2400 $$ = error_mark_node;
2403 | SIGOF '(' type_id ')'
2405 if (current_aggr == signature_type_node)
2407 if (IS_AGGR_TYPE (groktypename ($3.t)))
2409 sorry ("`sigof' as base signature specifier");
2410 $$ = groktypename ($3.t);
2414 error ("`sigof' applied to non-aggregate expression");
2415 $$ = error_mark_node;
2420 error ("`sigof' in struct or class declaration");
2421 $$ = error_mark_node;
2426 base_class_access_list:
2427 VISSPEC see_typename
2428 | SCSPEC see_typename
2429 { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
2430 sorry ("non-virtual access");
2431 $$ = access_default_virtual_node; }
2432 | base_class_access_list VISSPEC see_typename
2434 if ($2 == access_protected_node)
2436 warning ("`protected' access not implemented");
2437 $2 = access_public_node;
2440 else if ($2 == access_public_node)
2442 if ($1 == access_private_node)
2445 error ("base class cannot be public and private");
2447 else if ($1 == access_default_virtual_node)
2448 $$ = access_public_virtual_node;
2450 else /* $2 == access_private_node */
2452 if ($1 == access_public_node)
2454 else if ($1 == access_default_virtual_node)
2455 $$ = access_private_virtual_node;
2458 | base_class_access_list SCSPEC see_typename
2459 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2460 sorry ("non-virtual access");
2461 if ($$ == access_public_node)
2462 $$ = access_public_virtual_node;
2463 else if ($$ == access_private_node)
2464 $$ = access_private_virtual_node; }
2469 { tree t = $<ttype>0;
2470 push_obstacks_nochange ();
2471 end_temporary_allocation ();
2473 if (! IS_AGGR_TYPE (t))
2475 t = $<ttype>0 = make_lang_type (RECORD_TYPE);
2476 TYPE_NAME (t) = get_identifier ("erroneous type");
2479 duplicate_tag_error (t);
2480 if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
2482 t = make_lang_type (TREE_CODE (t));
2483 pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
2486 if (processing_template_decl && TYPE_CONTEXT (t)
2487 && ! current_class_type)
2488 push_template_decl (TYPE_STUB_DECL (t));
2490 TYPE_BEING_DEFINED (t) = 1;
2491 if (IS_AGGR_TYPE (t) && CLASSTYPE_USE_TEMPLATE (t))
2493 if (CLASSTYPE_IMPLICIT_INSTANTIATION (t)
2494 && TYPE_SIZE (t) == NULL_TREE)
2496 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
2497 if (processing_template_decl)
2498 push_template_decl (TYPE_MAIN_DECL (t));
2500 else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
2501 cp_error ("specialization after instantiation of `%T'", t);
2503 /* Reset the interface data, at the earliest possible
2504 moment, as it might have been set via a class foo;
2506 /* Don't change signatures. */
2507 if (! IS_SIGNATURE (t))
2509 extern tree pending_vtables;
2511 tree name = TYPE_IDENTIFIER (t);
2513 if (! ANON_AGGRNAME_P (name))
2515 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
2516 SET_CLASSTYPE_INTERFACE_UNKNOWN_X
2517 (t, interface_unknown);
2520 /* Record how to set the access of this class's
2521 virtual functions. If write_virtuals == 2 or 3, then
2522 inline virtuals are ``extern inline''. */
2523 switch (write_virtuals)
2530 needs_writing = !! value_member (name, pending_vtables);
2533 needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
2534 && CLASSTYPE_INTERFACE_KNOWN (t);
2539 CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
2542 t = TYPE_IDENTIFIER ($<ttype>0);
2543 if (t && IDENTIFIER_TEMPLATE (t))
2544 overload_template_name (t, 1);
2552 if (CLASSTYPE_TEMPLATE_INFO (current_class_type))
2555 $$ = build_self_reference ();
2559 opt.component_decl_list:
2561 { if ($$) $$ = build_tree_list (access_public_node, $$); }
2562 | self_reference component_decl_list
2564 if (current_aggr == signature_type_node)
2565 $$ = build_tree_list (access_public_node, $2);
2567 $$ = build_tree_list (access_default_node, $2);
2568 if ($1) $$ = tree_cons (access_public_node, $1, $$);
2570 | opt.component_decl_list VISSPEC ':' component_decl_list
2574 if (current_aggr == signature_type_node)
2576 error ("access specifier not allowed in signature");
2577 visspec = access_public_node;
2579 $$ = chainon ($$, build_tree_list (visspec, $4));
2581 | opt.component_decl_list VISSPEC ':'
2583 if (current_aggr == signature_type_node)
2584 error ("access specifier not allowed in signature");
2588 /* Note: we no longer warn about the semicolon after a component_decl_list.
2589 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2590 component_decl_list:
2592 { if ($$ == void_type_node) $$ = NULL_TREE;
2594 | component_decl_list component_decl
2595 { /* In pushdecl, we created a reverse list of names
2596 in this binding level. Make sure that the chain
2597 of what we're trying to add isn't the item itself
2598 (which can happen with what pushdecl's doing). */
2599 if ($2 != NULL_TREE && $2 != void_type_node)
2601 if (TREE_CHAIN ($2) != $$)
2602 $$ = chainon ($$, $2);
2610 component_decl_1 ';'
2612 | component_decl_1 '}'
2613 { error ("missing ';' before right brace");
2614 yyungetc ('}', 0); }
2615 /* C++: handle constructors, destructors and inline functions */
2616 /* note that INLINE is like a TYPESPEC */
2617 | fn.def2 ':' /* base_init compstmt */
2618 { $$ = finish_method ($$); }
2619 | fn.def2 TRY /* base_init compstmt */
2620 { $$ = finish_method ($$); }
2621 | fn.def2 RETURN /* base_init compstmt */
2622 { $$ = finish_method ($$); }
2623 | fn.def2 '{' /* nodecls compstmt */
2624 { $$ = finish_method ($$); }
2630 /* Do not add a "typed_declspecs declarator" rule here for
2631 speed; we need to call grok_x_components for enums, so the
2632 speedup would be insignificant. */
2633 typed_declspecs components
2634 { $$ = grok_x_components ($1.t, $2); }
2635 | declmods notype_components
2636 { $$ = grok_x_components ($1, $2); }
2637 | notype_declarator maybeasm maybe_attribute maybe_init
2638 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2639 build_tree_list ($3, NULL_TREE)); }
2640 | constructor_declarator maybeasm maybe_attribute maybe_init
2641 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2642 build_tree_list ($3, NULL_TREE)); }
2643 | ':' expr_no_commas
2644 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2648 /* These rules introduce a reduce/reduce conflict; in
2649 typedef int foo, bar;
2653 should "A::foo" be declared as a function or "A::bar" as a data
2654 member? In other words, is "bar" an after_type_declarator or a
2656 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2657 { tree specs, attrs;
2658 split_specs_attrs ($1, &specs, &attrs);
2659 $$ = grokfield ($2, specs, $5, $3,
2660 build_tree_list ($4, attrs)); }
2661 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2662 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2663 build_tree_list ($3, NULL_TREE)); }
2665 { $$ = do_class_using_decl ($1); }
2668 /* The case of exactly one component is handled directly by component_decl. */
2671 /* empty: possibly anonymous */
2673 | component_declarator0
2674 | components ',' component_declarator
2676 /* In this context, void_type_node encodes
2677 friends. They have been recorded elsewhere. */
2678 if ($$ == void_type_node)
2681 $$ = chainon ($$, $3);
2686 /* empty: possibly anonymous */
2688 | notype_component_declarator0
2689 | notype_components ',' notype_component_declarator
2691 /* In this context, void_type_node encodes
2692 friends. They have been recorded elsewhere. */
2693 if ($$ == void_type_node)
2696 $$ = chainon ($$, $3);
2700 component_declarator0:
2701 after_type_component_declarator0
2702 | notype_component_declarator0
2705 component_declarator:
2706 after_type_component_declarator
2707 | notype_component_declarator
2710 after_type_component_declarator0:
2711 after_type_declarator maybeasm maybe_attribute maybe_init
2712 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2713 &prefix_attributes);
2714 $<ttype>0 = current_declspecs;
2715 $$ = grokfield ($$, current_declspecs, $4, $2,
2716 build_tree_list ($3, prefix_attributes)); }
2717 | TYPENAME ':' expr_no_commas maybe_attribute
2718 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2719 &prefix_attributes);
2720 $<ttype>0 = current_declspecs;
2721 $$ = grokbitfield ($$, current_declspecs, $3);
2722 cplus_decl_attributes ($$, $4, prefix_attributes); }
2725 notype_component_declarator0:
2726 notype_declarator maybeasm maybe_attribute maybe_init
2727 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2728 &prefix_attributes);
2729 $<ttype>0 = current_declspecs;
2730 $$ = grokfield ($$, current_declspecs, $4, $2,
2731 build_tree_list ($3, prefix_attributes)); }
2732 | constructor_declarator maybeasm maybe_attribute maybe_init
2733 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2734 &prefix_attributes);
2735 $<ttype>0 = current_declspecs;
2736 $$ = grokfield ($$, current_declspecs, $4, $2,
2737 build_tree_list ($3, prefix_attributes)); }
2738 | IDENTIFIER ':' expr_no_commas maybe_attribute
2739 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2740 &prefix_attributes);
2741 $<ttype>0 = current_declspecs;
2742 $$ = grokbitfield ($$, current_declspecs, $3);
2743 cplus_decl_attributes ($$, $4, prefix_attributes); }
2744 | ':' expr_no_commas maybe_attribute
2745 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2746 &prefix_attributes);
2747 $<ttype>0 = current_declspecs;
2748 $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2749 cplus_decl_attributes ($$, $3, prefix_attributes); }
2752 after_type_component_declarator:
2753 after_type_declarator maybeasm maybe_attribute maybe_init
2754 { $$ = grokfield ($$, current_declspecs, $4, $2,
2755 build_tree_list ($3, prefix_attributes)); }
2756 | TYPENAME ':' expr_no_commas maybe_attribute
2757 { $$ = grokbitfield ($$, current_declspecs, $3);
2758 cplus_decl_attributes ($$, $4, prefix_attributes); }
2761 notype_component_declarator:
2762 notype_declarator maybeasm maybe_attribute maybe_init
2763 { $$ = grokfield ($$, current_declspecs, $4, $2,
2764 build_tree_list ($3, prefix_attributes)); }
2765 | IDENTIFIER ':' expr_no_commas maybe_attribute
2766 { $$ = grokbitfield ($$, current_declspecs, $3);
2767 cplus_decl_attributes ($$, $4, prefix_attributes); }
2768 | ':' expr_no_commas maybe_attribute
2769 { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2770 cplus_decl_attributes ($$, $3, prefix_attributes); }
2773 /* We chain the enumerators in reverse order.
2774 Because of the way enums are built, the order is
2775 insignificant. Take advantage of this fact. */
2779 | enumlist ',' enumerator
2780 { TREE_CHAIN ($3) = $$; $$ = $3; }
2785 { $$ = build_enumerator ($$, NULL_TREE); }
2786 | identifier '=' expr_no_commas
2787 { $$ = build_enumerator ($$, $3); }
2790 /* ANSI new-type-id (5.3.4) */
2792 type_specifier_seq new_declarator
2793 { $$.t = build_decl_list ($1.t, $2);
2794 $$.new_type_flag = $1.new_type_flag; }
2795 | type_specifier_seq %prec EMPTY
2796 { $$.t = build_decl_list ($1.t, NULL_TREE);
2797 $$.new_type_flag = $1.new_type_flag; }
2798 /* GNU extension to allow arrays of arbitrary types with
2799 non-constant dimension. */
2800 | '(' type_id ')' '[' expr ']'
2803 pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
2804 $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
2805 $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
2806 $$.new_type_flag = $2.new_type_flag;
2811 /* empty */ %prec EMPTY
2813 | cv_qualifiers CV_QUALIFIER
2814 { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
2817 nonempty_cv_qualifiers:
2819 { $$.t = IDENTIFIER_AS_LIST ($1);
2820 $$.new_type_flag = 0; }
2821 | nonempty_cv_qualifiers CV_QUALIFIER
2822 { $$.t = decl_tree_cons (NULL_TREE, $2, $1.t);
2823 $$.new_type_flag = $1.new_type_flag; }
2826 /* These rules must follow the rules for function declarations
2827 and component declarations. That way, longer rules are preferred. */
2831 { $<itype>$ = suspend_momentary (); }
2833 /* An expression which will not live on the momentary obstack. */
2836 { resume_momentary ((int) $<itype>1); $$ = $2; }
2839 /* An expression which will not live on the momentary obstack. */
2841 suspend_mom '(' nonnull_exprlist ')'
2842 { resume_momentary ((int) $<itype>1); $$ = $3; }
2843 | suspend_mom '(' parmlist ')'
2844 { resume_momentary ((int) $<itype>1); $$ = $3; }
2845 | suspend_mom LEFT_RIGHT
2846 { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
2847 | suspend_mom '(' error ')'
2848 { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
2851 /* A declarator that is allowed only after an explicit typespec. */
2852 /* may all be followed by prec '.' */
2853 after_type_declarator:
2854 '*' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2855 { $$ = make_pointer_declarator ($2.t, $3); }
2856 | '&' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2857 { $$ = make_reference_declarator ($2.t, $3); }
2858 | '*' after_type_declarator %prec UNARY
2859 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2860 | '&' after_type_declarator %prec UNARY
2861 { $$ = make_reference_declarator (NULL_TREE, $2); }
2862 | ptr_to_mem cv_qualifiers after_type_declarator
2863 { tree arg = make_pointer_declarator ($2, $3);
2864 $$ = build_parse_node (SCOPE_REF, $1, arg);
2866 | direct_after_type_declarator
2870 type_name %prec EMPTY
2872 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2874 if (current_class_type
2875 && TYPE_BEING_DEFINED (current_class_type)
2876 && ! IDENTIFIER_CLASS_VALUE ($1))
2878 /* Be sure to get an inherited typedef. */
2879 $$ = lookup_name ($1, 1);
2880 /* Remember that this name has been used in the class
2881 definition, as per [class.scope0] */
2882 pushdecl_class_level ($$);
2885 $$ = identifier_typedecl_value ($1);
2890 | global_scope type_name
2892 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2893 $$ = identifier_typedecl_value ($2);
2896 got_scope = NULL_TREE;
2899 | global_scope nested_type
2904 nested_name_specifier type_name %prec EMPTY
2905 { $$ = get_type_decl ($2); }
2908 direct_after_type_declarator:
2909 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2910 { $$ = make_call_declarator ($$, $2, $3, $4); }
2911 | direct_after_type_declarator '[' nonmomentary_expr ']'
2912 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2913 | direct_after_type_declarator '[' ']'
2914 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2915 | '(' after_type_declarator ')'
2917 | nested_name_specifier type_name %prec EMPTY
2918 { push_nested_class ($1, 3);
2919 $$ = build_parse_node (SCOPE_REF, $$, $2);
2920 TREE_COMPLEXITY ($$) = current_class_depth; }
2921 | type_name %prec EMPTY
2924 /* A declarator allowed whether or not there has been
2925 an explicit typespec. These cannot redeclare a typedef-name. */
2928 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2929 { $$ = make_pointer_declarator ($2.t, $3); }
2930 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2931 { $$ = make_reference_declarator ($2.t, $3); }
2932 | '*' notype_declarator %prec UNARY
2933 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2934 | '&' notype_declarator %prec UNARY
2935 { $$ = make_reference_declarator (NULL_TREE, $2); }
2936 | ptr_to_mem cv_qualifiers notype_declarator
2937 { tree arg = make_pointer_declarator ($2, $3);
2938 $$ = build_parse_node (SCOPE_REF, $1, arg);
2940 | direct_notype_declarator
2943 complex_notype_declarator:
2944 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2945 { $$ = make_pointer_declarator ($2.t, $3); }
2946 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2947 { $$ = make_reference_declarator ($2.t, $3); }
2948 | '*' complex_notype_declarator %prec UNARY
2949 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2950 | '&' complex_notype_declarator %prec UNARY
2951 { $$ = make_reference_declarator (NULL_TREE, $2); }
2952 | ptr_to_mem cv_qualifiers notype_declarator
2953 { tree arg = make_pointer_declarator ($2, $3);
2954 $$ = build_parse_node (SCOPE_REF, $1, arg);
2956 | complex_direct_notype_declarator
2959 complex_direct_notype_declarator:
2960 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2961 { $$ = make_call_declarator ($$, $2, $3, $4); }
2962 | '(' complex_notype_declarator ')'
2964 | direct_notype_declarator '[' nonmomentary_expr ']'
2965 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2966 | direct_notype_declarator '[' ']'
2967 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2968 | notype_qualified_id
2969 { if (OP0 ($$) != current_class_type)
2971 push_nested_class (OP0 ($$), 3);
2972 TREE_COMPLEXITY ($$) = current_class_depth;
2978 nested_name_specifier unqualified_id
2979 { got_scope = NULL_TREE;
2980 $$ = build_parse_node (SCOPE_REF, $$, $2); }
2983 notype_qualified_id:
2984 nested_name_specifier notype_unqualified_id
2985 { got_scope = NULL_TREE;
2986 $$ = build_parse_node (SCOPE_REF, $$, $2); }
2991 | global_scope notype_qualified_id
2996 typespec '(' nonnull_exprlist ')'
2997 { $$ = build_functional_cast ($1.t, $3); }
2998 | typespec '(' expr_or_declarator ')'
2999 { $$ = reparse_decl_as_expr ($1.t, $3); }
3000 | typespec fcast_or_absdcl %prec EMPTY
3001 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3007 | template_type %prec EMPTY
3010 nested_name_specifier:
3011 nested_name_specifier_1
3012 | nested_name_specifier nested_name_specifier_1
3016 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3017 inline here?!? (jason) */
3018 nested_name_specifier_1:
3021 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3024 /* Remember that this name has been used in the class
3025 definition, as per [class.scope0] */
3026 if (current_class_type
3027 && TYPE_BEING_DEFINED (current_class_type)
3028 && ! IDENTIFIER_CLASS_VALUE ($1))
3029 pushdecl_class_level ($$);
3031 got_scope = $$ = TREE_TYPE ($$);
3035 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3037 got_scope = $$ = TREE_TYPE ($$);
3040 { got_scope = $$ = $1; }
3041 | template_type SCOPE
3042 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3043 /* These break 'const i;'
3047 cp_error ("`%D' is not an aggregate typedef",
3048 lastiddecl ? lastiddecl : $$);
3049 $$ = error_mark_node;
3052 { goto failed_scope; } */
3056 global_scope type_name
3058 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3059 $$ = identifier_typedecl_value ($2);
3062 got_scope = NULL_TREE;
3065 | global_scope nested_type
3070 nested_name_specifier '*'
3071 { got_scope = NULL_TREE; }
3072 | global_scope nested_name_specifier '*'
3073 { $$ = $2; got_scope = NULL_TREE; }
3076 /* All uses of explicit global scope must go through this nonterminal so
3077 that got_scope will be set before yylex is called to get the next token. */
3080 { got_scope = void_type_node; }
3083 /* ANSI new-declarator (5.3.4) */
3085 '*' cv_qualifiers new_declarator
3086 { $$ = make_pointer_declarator ($2, $3); }
3087 | '*' cv_qualifiers %prec EMPTY
3088 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3089 | '&' cv_qualifiers new_declarator %prec EMPTY
3090 { $$ = make_reference_declarator ($2, $3); }
3091 | '&' cv_qualifiers %prec EMPTY
3092 { $$ = make_reference_declarator ($2, NULL_TREE); }
3093 | ptr_to_mem cv_qualifiers %prec EMPTY
3094 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3095 $$ = build_parse_node (SCOPE_REF, $1, arg);
3097 | ptr_to_mem cv_qualifiers new_declarator
3098 { tree arg = make_pointer_declarator ($2, $3);
3099 $$ = build_parse_node (SCOPE_REF, $1, arg);
3101 | direct_new_declarator %prec EMPTY
3104 /* ANSI direct-new-declarator (5.3.4) */
3105 direct_new_declarator:
3107 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3108 | direct_new_declarator '[' nonmomentary_expr ']'
3109 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3112 /* ANSI abstract-declarator (8.1) */
3114 '*' nonempty_cv_qualifiers absdcl
3115 { $$ = make_pointer_declarator ($2.t, $3); }
3117 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3118 | '*' nonempty_cv_qualifiers %prec EMPTY
3119 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3121 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3122 | '&' nonempty_cv_qualifiers absdcl
3123 { $$ = make_reference_declarator ($2.t, $3); }
3125 { $$ = make_reference_declarator (NULL_TREE, $2); }
3126 | '&' nonempty_cv_qualifiers %prec EMPTY
3127 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3129 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3130 | ptr_to_mem cv_qualifiers %prec EMPTY
3131 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3132 $$ = build_parse_node (SCOPE_REF, $1, arg);
3134 | ptr_to_mem cv_qualifiers absdcl
3135 { tree arg = make_pointer_declarator ($2, $3);
3136 $$ = build_parse_node (SCOPE_REF, $1, arg);
3138 | direct_abstract_declarator %prec EMPTY
3141 /* ANSI direct-abstract-declarator (8.1) */
3142 direct_abstract_declarator:
3145 /* `(typedef)1' is `int'. */
3147 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3148 { $$ = make_call_declarator ($$, $3, $5, $6); }
3149 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3150 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3151 | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
3152 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3153 | direct_abstract_declarator '[' ']' %prec '.'
3154 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3155 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3156 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3157 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3158 { set_quals_and_spec ($$, $2, $3); }
3159 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3160 { set_quals_and_spec ($$, $2, $3); }
3161 | '[' nonmomentary_expr ']' %prec '.'
3162 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3164 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
3167 /* For C++, decls and stmts can be intermixed, so we don't need to
3168 have a special rule that won't start parsing the stmt section
3169 until we have a stmt that parses without errors. */
3182 /* build the LET_STMT node before parsing its contents,
3183 so that any LET_STMTs within the context can have their display pointers
3184 set up to point at this one. */
3188 { do_pushlevel (); }
3193 { $$ = do_poplevel (); }
3196 /* Read zero or more forward-declarations for labels
3197 that nested functions can jump to. */
3202 pedwarn ("ANSI C++ forbids label declarations"); }
3207 | label_decls label_decl
3211 LABEL identifiers_or_typenames ';'
3213 for (link = $2; link; link = TREE_CHAIN (link))
3215 tree label = shadow_label (TREE_VALUE (link));
3216 C_DECLARED_LABEL_FLAG (label) = 1;
3217 declare_nonlocal_label (label);
3222 /* This is the body of a function definition.
3223 It causes syntax errors to ignore to the next openbrace. */
3233 if (processing_template_decl)
3235 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3236 add_tree ($<ttype>$);
3239 .pushlevel compstmtend .poplevel
3241 if (processing_template_decl)
3243 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3244 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3245 last_tree = $<ttype>2;
3254 if (processing_template_decl)
3256 $<ttype>$ = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE,
3258 add_tree ($<ttype>$);
3260 cond_stmt_keyword = "if";
3262 .pushlevel paren_cond_or_null
3264 if (processing_template_decl)
3266 if (last_tree != $<ttype>2)
3268 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3269 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3270 last_tree = $<ttype>2;
3273 TREE_OPERAND ($<ttype>2, 0) = $4;
3277 emit_line_note (input_filename, lineno);
3278 expand_start_cond ($4, 0);
3281 implicitly_scoped_stmt
3283 if (processing_template_decl)
3285 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3286 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3287 $<ttype>$ = last_tree = $<ttype>2;
3292 implicitly_scoped_stmt:
3297 if (processing_template_decl)
3299 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3300 add_tree ($<ttype>$);
3303 simple_stmt .poplevel
3305 if (processing_template_decl)
3307 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3308 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3309 last_tree = $<ttype>2;
3327 if (! processing_template_decl)
3329 emit_line_note (input_filename, lineno);
3330 /* Do default conversion if safe and possibly important,
3331 in case within ({...}). */
3332 if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
3334 || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
3335 expr = default_conversion (expr);
3337 cplus_expand_expr_stmt (expr);
3341 { if (! processing_template_decl) expand_start_else (); }
3342 implicitly_scoped_stmt
3344 if (processing_template_decl)
3346 TREE_OPERAND ($<ttype>1, 2) = TREE_CHAIN ($<ttype>1);
3347 TREE_CHAIN ($<ttype>1) = NULL_TREE;
3348 last_tree = $<ttype>1;
3355 | simple_if %prec IF
3356 { if (! processing_template_decl) expand_end_cond ();
3361 if (processing_template_decl)
3363 $<ttype>$ = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
3364 add_tree ($<ttype>$);
3369 emit_line_note (input_filename, lineno);
3370 expand_start_loop (1);
3372 cond_stmt_keyword = "while";
3374 .pushlevel paren_cond_or_null
3376 if (processing_template_decl)
3378 if (last_tree != $<ttype>2)
3380 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3381 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3382 last_tree = $<ttype>2;
3385 TREE_OPERAND ($<ttype>2, 0) = $4;
3389 emit_line_note (input_filename, lineno);
3390 expand_exit_loop_if_false (0, $4);
3393 already_scoped_stmt .poplevel
3395 if (processing_template_decl)
3397 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3398 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3399 last_tree = $<ttype>2;
3407 if (processing_template_decl)
3409 $<ttype>$ = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
3410 add_tree ($<ttype>$);
3415 emit_line_note (input_filename, lineno);
3416 expand_start_loop_continue_elsewhere (1);
3419 implicitly_scoped_stmt WHILE
3421 if (processing_template_decl)
3423 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3424 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3425 last_tree = $<ttype>2;
3429 expand_loop_continue_here ();
3430 cond_stmt_keyword = "do";
3433 paren_expr_or_null ';'
3435 if (processing_template_decl)
3436 TREE_OPERAND ($<ttype>2, 1) = $6;
3439 emit_line_note (input_filename, lineno);
3440 expand_exit_loop_if_false (0, $6);
3447 { if (processing_template_decl)
3449 $<ttype>$ = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
3450 NULL_TREE, NULL_TREE);
3451 add_tree ($<ttype>$);
3454 emit_line_note (input_filename, lineno);
3455 if (flag_new_for_scope > 0)
3457 /* Conditionalize .pushlevel */
3459 note_level_for_for ();
3462 expand_start_bindings (0);
3465 '(' for.init.statement
3467 if (processing_template_decl)
3469 if (last_tree != $<ttype>2)
3471 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3472 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3473 last_tree = $<ttype>2;
3479 emit_line_note (input_filename, lineno);
3480 expand_start_loop_continue_elsewhere (1);
3483 .pushlevel xcond ';'
3485 if (processing_template_decl)
3487 if (last_tree != $<ttype>2)
3489 TREE_OPERAND ($<ttype>2, 1) = last_tree;
3490 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3491 last_tree = $<ttype>2;
3494 TREE_OPERAND ($<ttype>2, 1) = $7;
3498 emit_line_note (input_filename, lineno);
3499 if ($7) expand_exit_loop_if_false (0, $7);
3503 /* Don't let the tree nodes for $10 be discarded
3504 by clear_momentary during the parsing of the next stmt. */
3506 if (processing_template_decl)
3507 TREE_OPERAND ($<ttype>2, 2) = $10;
3510 already_scoped_stmt .poplevel
3512 if (processing_template_decl)
3514 TREE_OPERAND ($<ttype>2, 3) = TREE_CHAIN ($<ttype>2);
3515 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3516 last_tree = $<ttype>2;
3520 emit_line_note (input_filename, lineno);
3521 expand_loop_continue_here ();
3522 if ($10) cplus_expand_expr_stmt ($10);
3526 if (flag_new_for_scope > 0)
3531 | SWITCH .pushlevel '(' condition ')'
3533 if (processing_template_decl)
3535 $<ttype>$ = build_min_nt (SWITCH_STMT, $4, NULL_TREE);
3536 add_tree ($<ttype>$);
3540 emit_line_note (input_filename, lineno);
3541 c_expand_start_case ($4);
3544 /* Don't let the tree nodes for $4 be discarded by
3545 clear_momentary during the parsing of the next stmt. */
3548 implicitly_scoped_stmt
3550 if (processing_template_decl)
3552 TREE_OPERAND ($<ttype>6, 1) = TREE_CHAIN ($<ttype>6);
3553 TREE_CHAIN ($<ttype>6) = NULL_TREE;
3554 last_tree = $<ttype>6;
3557 expand_end_case ($4);
3563 | CASE expr_no_commas ':'
3564 { do_case ($2, NULL_TREE); }
3566 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3567 { do_case ($2, $4); }
3570 { do_case (NULL_TREE, NULL_TREE); }
3573 { emit_line_note (input_filename, lineno);
3574 if (processing_template_decl)
3575 add_tree (build_min_nt (BREAK_STMT));
3576 else if ( ! expand_exit_something ())
3577 error ("break statement not within loop or switch"); }
3579 { emit_line_note (input_filename, lineno);
3580 if (processing_template_decl)
3581 add_tree (build_min_nt (CONTINUE_STMT));
3582 else if (! expand_continue_loop (0))
3583 error ("continue statement not within a loop"); }
3585 { emit_line_note (input_filename, lineno);
3586 c_expand_return (NULL_TREE); }
3588 { emit_line_note (input_filename, lineno);
3589 c_expand_return ($2);
3592 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3593 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3594 emit_line_note (input_filename, lineno);
3598 /* This is the case with just output operands. */
3599 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3600 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3601 emit_line_note (input_filename, lineno);
3602 c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
3603 $2 == ridpointers[(int)RID_VOLATILE],
3604 input_filename, lineno);
3607 /* This is the case with input operands as well. */
3608 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
3609 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3610 emit_line_note (input_filename, lineno);
3611 c_expand_asm_operands ($4, $6, $8, NULL_TREE,
3612 $2 == ridpointers[(int)RID_VOLATILE],
3613 input_filename, lineno);
3616 /* This is the case with clobbered registers as well. */
3617 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3618 asm_operands ':' asm_clobbers ')' ';'
3619 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3620 emit_line_note (input_filename, lineno);
3621 c_expand_asm_operands ($4, $6, $8, $10,
3622 $2 == ridpointers[(int)RID_VOLATILE],
3623 input_filename, lineno);
3628 if (processing_template_decl)
3629 add_tree (build_min_nt (GOTO_STMT, $3));
3631 { emit_line_note (input_filename, lineno);
3632 expand_computed_goto ($3); }
3634 | GOTO identifier ';'
3636 if (processing_template_decl)
3637 add_tree (build_min_nt (GOTO_STMT, $2));
3641 emit_line_note (input_filename, lineno);
3642 decl = lookup_label ($2);
3643 TREE_USED (decl) = 1;
3650 { error ("label must be followed by statement");
3661 if (! current_function_parms_stored)
3662 store_parm_decls ();
3663 expand_start_early_try_stmts ();
3665 ctor_initializer_opt compstmt_or_error
3666 { expand_start_all_catch (); }
3669 int nested = (hack_decl_function_context
3670 (current_function_decl) != NULL_TREE);
3671 expand_end_all_catch ();
3672 finish_function (lineno, (int)$3, nested);
3678 { expand_start_try_stmts (); }
3680 { expand_start_all_catch (); }
3682 { expand_end_all_catch (); }
3687 | handler_seq CATCH .pushlevel handler_args compstmt
3688 { expand_end_catch_block (); }
3693 typed_typespecs %prec EMPTY
3694 | nonempty_cv_qualifiers %prec EMPTY
3699 { expand_start_catch_block (NULL_TREE, NULL_TREE); }
3700 /* This doesn't allow reference parameters, the below does.
3701 | '(' type_specifier_seq absdcl ')'
3702 { check_for_new_type ("inside exception declarations", $2);
3703 expand_start_catch_block ($2.t, $3); }
3704 | '(' type_specifier_seq ')'
3705 { check_for_new_type ("inside exception declarations", $2);
3706 expand_start_catch_block ($2.t, NULL_TREE); }
3707 | '(' type_specifier_seq notype_declarator ')'
3708 { check_for_new_type ("inside exception declarations", $2);
3709 expand_start_catch_block ($2.t, $3); }
3710 | '(' typed_typespecs after_type_declarator ')'
3711 { check_for_new_type ("inside exception declarations", $2);
3712 expand_start_catch_block ($2.t, $3); }
3713 This allows reference parameters... */
3715 { check_for_new_type ("inside exception declarations", $2);
3716 expand_start_catch_block (TREE_PURPOSE ($2.t),
3717 TREE_VALUE ($2.t)); }
3724 label = define_label (input_filename, lineno, $1);
3725 if (label && ! minimal_parse_mode)
3726 expand_label (label);
3738 { if ($1) cplus_expand_expr_stmt ($1); }
3742 pedwarn ("ANSI C++ forbids compound statements inside for initializations");
3746 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3750 { emit_line_note (input_filename, lineno);
3753 { emit_line_note (input_filename, lineno); }
3764 /* These are the operands other than the first string and colon
3765 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3769 | nonnull_asm_operands
3772 nonnull_asm_operands:
3774 | nonnull_asm_operands ',' asm_operand
3775 { $$ = chainon ($$, $3); }
3780 { $$ = build_tree_list ($$, $3); }
3785 { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
3786 | asm_clobbers ',' STRING
3787 { $$ = tree_cons (NULL_TREE, $3, $$); }
3790 /* This is what appears inside the parens in a function declarator.
3791 Its value is represented in the format that grokdeclarator expects.
3793 In C++, declaring a function with no parameters
3794 means that that function takes *no* parameters. */
3803 { $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3804 TREE_PARMLIST ($$) = 1;
3805 check_for_new_type ("inside parameter list", $1); }
3808 /* This nonterminal does not include the common sequence '(' type_id ')',
3809 as it is ambiguous and must be disambiguated elsewhere. */
3813 $$ = chainon ($$, void_list_node);
3814 TREE_PARMLIST ($$) = 1;
3816 | parms_comma ELLIPSIS
3818 TREE_PARMLIST ($$) = 1;
3820 /* C++ allows an ellipsis without a separating ',' */
3823 TREE_PARMLIST ($$) = 1;
3827 $$ = build_tree_list (NULL_TREE, $1.t);
3828 TREE_PARMLIST ($$) = 1;
3836 TREE_PARMLIST ($$) = 1;
3838 | parms TYPENAME_ELLIPSIS
3840 TREE_PARMLIST ($$) = 1;
3842 | type_id TYPENAME_ELLIPSIS
3844 $$ = build_tree_list (NULL_TREE, $1.t);
3845 TREE_PARMLIST ($$) = 1;
3849 /* This helps us recover from really nasty
3850 parse errors, for example, a missing right
3852 yyerror ("possibly missing ')'");
3853 $$ = chainon ($$, void_list_node);
3854 TREE_PARMLIST ($$) = 1;
3860 /* This helps us recover from really nasty
3861 parse errors, for example, a missing right
3863 yyerror ("possibly missing ')'");
3864 $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3865 TREE_PARMLIST ($$) = 1;
3871 /* A nonempty list of parameter declarations or type names. */
3874 { check_for_new_type ("in a parameter list", $1);
3875 $$ = build_tree_list (NULL_TREE, $1.t); }
3877 { check_for_new_type ("in a parameter list", $1);
3878 $$ = build_tree_list ($3, $1.t); }
3879 | parms_comma full_parm
3880 { check_for_new_type ("in a parameter list", $2);
3881 $$ = chainon ($$, $2.t); }
3882 | parms_comma bad_parm
3883 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
3884 | parms_comma bad_parm '=' init
3885 { $$ = chainon ($$, build_tree_list ($4, $2)); }
3891 { check_for_new_type ("in a parameter list", $1);
3892 $$ = build_tree_list (NULL_TREE, $1.t); }
3895 /* A single parameter declaration or parameter type name,
3896 as found in a parmlist. */
3898 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3899 TYPESPEC IDENTIFIER. */
3900 typed_declspecs1 declarator
3901 { tree specs = strip_attrs ($1.t);
3902 $$.new_type_flag = $1.new_type_flag;
3903 $$.t = build_tree_list (specs, $2); }
3904 | typed_typespecs declarator
3905 { $$.t = build_tree_list ($1.t, $2);
3906 $$.new_type_flag = $1.new_type_flag; }
3907 | typespec declarator
3908 { $$.t = build_tree_list (get_decl_list ($1.t), $2);
3909 $$.new_type_flag = $1.new_type_flag; }
3910 | typed_declspecs1 absdcl
3911 { tree specs = strip_attrs ($1.t);
3912 $$.t = build_tree_list (specs, $2);
3913 $$.new_type_flag = $1.new_type_flag; }
3914 | typed_declspecs1 %prec EMPTY
3915 { tree specs = strip_attrs ($1.t);
3916 $$.t = build_tree_list (specs, NULL_TREE);
3917 $$.new_type_flag = $1.new_type_flag; }
3918 | declmods notype_declarator
3919 { tree specs = strip_attrs ($1);
3920 $$.t = build_tree_list (specs, $2);
3921 $$.new_type_flag = 0; }
3926 { $$.t = build_tree_list ($2, $1.t);
3927 $$.new_type_flag = $1.new_type_flag; }
3936 /* empty */ %prec EMPTY
3937 { see_typename (); }
3941 /* empty */ %prec EMPTY
3943 error ("type specifier omitted for parameter");
3944 $$ = build_tree_list (integer_type_node, NULL_TREE);
3948 error ("type specifier omitted for parameter");
3949 if (TREE_CODE ($$) == SCOPE_REF
3950 && TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM)
3951 cp_error (" perhaps you want `typename %E' to make it a type", $$);
3952 $$ = build_tree_list (integer_type_node, $$);
3956 exception_specification_opt:
3957 /* empty */ %prec EMPTY
3959 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
3961 | THROW LEFT_RIGHT %prec EMPTY
3962 { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
3965 ansi_raise_identifier:
3967 { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
3970 ansi_raise_identifiers:
3971 ansi_raise_identifier
3972 | ansi_raise_identifiers ',' ansi_raise_identifier
3974 TREE_CHAIN ($3) = $$;
3979 conversion_declarator:
3980 /* empty */ %prec EMPTY
3982 | '*' cv_qualifiers conversion_declarator
3983 { $$ = make_pointer_declarator ($2, $3); }
3984 | '&' cv_qualifiers conversion_declarator
3985 { $$ = make_reference_declarator ($2, $3); }
3986 | ptr_to_mem cv_qualifiers conversion_declarator
3987 { tree arg = make_pointer_declarator ($2, $3);
3988 $$ = build_parse_node (SCOPE_REF, $1, arg);
3994 { got_scope = NULL_TREE; }
3999 { $$ = ansi_opname[MULT_EXPR]; }
4001 { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
4003 { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
4005 { $$ = ansi_opname[PLUS_EXPR]; }
4007 { $$ = ansi_opname[MINUS_EXPR]; }
4009 { $$ = ansi_opname[BIT_AND_EXPR]; }
4011 { $$ = ansi_opname[BIT_IOR_EXPR]; }
4013 { $$ = ansi_opname[BIT_XOR_EXPR]; }
4015 { $$ = ansi_opname[BIT_NOT_EXPR]; }
4017 { $$ = ansi_opname[COMPOUND_EXPR]; }
4018 | operator ARITHCOMPARE
4019 { $$ = ansi_opname[$2]; }
4021 { $$ = ansi_opname[LT_EXPR]; }
4023 { $$ = ansi_opname[GT_EXPR]; }
4024 | operator EQCOMPARE
4025 { $$ = ansi_opname[$2]; }
4027 { $$ = ansi_assopname[$2]; }
4029 { $$ = ansi_opname [MODIFY_EXPR]; }
4031 { $$ = ansi_opname[$2]; }
4033 { $$ = ansi_opname[$2]; }
4035 { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
4036 | operator MINUSMINUS
4037 { $$ = ansi_opname[PREDECREMENT_EXPR]; }
4039 { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
4041 { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
4043 { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
4045 { $$ = ansi_opname[COND_EXPR]; }
4047 { $$ = ansi_opname[$2]; }
4048 | operator POINTSAT %prec EMPTY
4049 { $$ = ansi_opname[COMPONENT_REF]; }
4050 | operator POINTSAT_STAR %prec EMPTY
4051 { $$ = ansi_opname[MEMBER_REF]; }
4052 | operator LEFT_RIGHT
4053 { $$ = ansi_opname[CALL_EXPR]; }
4055 { $$ = ansi_opname[ARRAY_REF]; }
4056 | operator NEW %prec EMPTY
4057 { $$ = ansi_opname[NEW_EXPR]; }
4058 | operator DELETE %prec EMPTY
4059 { $$ = ansi_opname[DELETE_EXPR]; }
4060 | operator NEW '[' ']'
4061 { $$ = ansi_opname[VEC_NEW_EXPR]; }
4062 | operator DELETE '[' ']'
4063 { $$ = ansi_opname[VEC_DELETE_EXPR]; }
4064 /* Names here should be looked up in class scope ALSO. */
4065 | operator type_specifier_seq conversion_declarator
4066 { $$ = grokoptypename ($2.t, $3); }
4068 { $$ = ansi_opname[ERROR_MARK]; }
4075 debug_yytranslate (value)
4078 return yytname[YYTRANSLATE (value)];