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)); }
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));
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)
2238 note_debug_info_needed (DECL_CONTEXT ($$));
2242 cp_error ("`%T' does not have a nested type named `%D'",
2245 (current_aggr, make_anon_name (), NULL_TREE, 1);
2246 $$ = TYPE_MAIN_DECL ($$);
2249 | aggr template_type
2250 { current_aggr = $$; $$ = $2; }
2251 | aggr nested_name_specifier template_type
2252 { current_aggr = $$; $$ = $3; }
2256 /* empty */ %prec EMPTY
2257 { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
2261 named_class_head_sans_basetype %prec EMPTY
2262 { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
2263 | named_class_head_sans_basetype_defn do_xref_defn
2264 maybe_base_class_list %prec EMPTY
2268 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2270 | named_complex_class_head_sans_basetype maybe_base_class_list
2272 $$ = TREE_TYPE ($1);
2273 if (TREE_INT_CST_LOW (current_aggr) == union_type
2274 && TREE_CODE ($$) != UNION_TYPE)
2275 cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
2276 else if (TREE_CODE ($$) == UNION_TYPE
2277 && TREE_INT_CST_LOW (current_aggr) != union_type)
2278 cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
2281 if (IS_AGGR_TYPE ($$) && CLASSTYPE_USE_TEMPLATE ($$))
2283 if (CLASSTYPE_IMPLICIT_INSTANTIATION ($$)
2284 && TYPE_SIZE ($$) == NULL_TREE)
2286 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION ($$);
2287 if (processing_template_decl)
2288 push_template_decl (TYPE_MAIN_DECL ($$));
2290 else if (CLASSTYPE_TEMPLATE_INSTANTIATION ($$))
2291 cp_error ("specialization after instantiation of `%T'", $$);
2293 xref_basetypes (current_aggr, $1, $$, $2);
2300 { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
2301 yyungetc ('{', 1); }
2309 maybe_base_class_list:
2310 /* empty */ %prec EMPTY
2312 | ':' see_typename %prec EMPTY
2313 { yyungetc(':', 1); $$ = NULL_TREE; }
2314 | ':' see_typename base_class_list %prec EMPTY
2320 | base_class_list ',' see_typename base_class
2321 { $$ = chainon ($$, $4); }
2327 tree type = TREE_TYPE ($1);
2328 if (! is_aggr_type (type, 1))
2330 else if (current_aggr == signature_type_node
2331 && (! type) && (! IS_SIGNATURE (type)))
2333 error ("class name not allowed as base signature");
2336 else if (current_aggr == signature_type_node)
2338 sorry ("signature inheritance, base type `%s' ignored",
2339 IDENTIFIER_POINTER ($$));
2340 $$ = build_tree_list (access_public_node, type);
2342 else if (type && IS_SIGNATURE (type))
2344 error ("signature name not allowed as base class");
2348 $$ = build_tree_list (access_default_node, type);
2350 | base_class_access_list see_typename base_class.1
2352 tree type = TREE_TYPE ($3);
2353 if (current_aggr == signature_type_node)
2354 error ("access and source specifiers not allowed in signature");
2355 if (! IS_AGGR_TYPE (type))
2357 else if (current_aggr == signature_type_node
2358 && (! type) && (! IS_SIGNATURE (type)))
2360 error ("class name not allowed as base signature");
2363 else if (current_aggr == signature_type_node)
2365 sorry ("signature inheritance, base type `%s' ignored",
2366 IDENTIFIER_POINTER ($$));
2367 $$ = build_tree_list (access_public_node, type);
2369 else if (type && IS_SIGNATURE (type))
2371 error ("signature name not allowed as base class");
2375 $$ = build_tree_list ($$, type);
2381 | TYPENAME_KEYWORD nested_name_specifier identifier
2382 { $$ = TYPE_MAIN_DECL (make_typename_type ($2, $3)); }
2383 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2384 { $$ = TYPE_MAIN_DECL (make_typename_type ($3, $4)); }
2385 | SIGOF '(' expr ')'
2387 if (current_aggr == signature_type_node)
2389 if (IS_AGGR_TYPE (TREE_TYPE ($3)))
2391 sorry ("`sigof' as base signature specifier");
2392 $$ = TREE_TYPE ($3);
2396 error ("`sigof' applied to non-aggregate expression");
2397 $$ = error_mark_node;
2402 error ("`sigof' in struct or class declaration");
2403 $$ = error_mark_node;
2406 | SIGOF '(' type_id ')'
2408 if (current_aggr == signature_type_node)
2410 if (IS_AGGR_TYPE (groktypename ($3.t)))
2412 sorry ("`sigof' as base signature specifier");
2413 $$ = groktypename ($3.t);
2417 error ("`sigof' applied to non-aggregate expression");
2418 $$ = error_mark_node;
2423 error ("`sigof' in struct or class declaration");
2424 $$ = error_mark_node;
2429 base_class_access_list:
2430 VISSPEC see_typename
2431 | SCSPEC see_typename
2432 { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
2433 sorry ("non-virtual access");
2434 $$ = access_default_virtual_node; }
2435 | base_class_access_list VISSPEC see_typename
2437 if ($2 == access_protected_node)
2439 warning ("`protected' access not implemented");
2440 $2 = access_public_node;
2443 else if ($2 == access_public_node)
2445 if ($1 == access_private_node)
2448 error ("base class cannot be public and private");
2450 else if ($1 == access_default_virtual_node)
2451 $$ = access_public_virtual_node;
2453 else /* $2 == access_private_node */
2455 if ($1 == access_public_node)
2457 else if ($1 == access_default_virtual_node)
2458 $$ = access_private_virtual_node;
2461 | base_class_access_list SCSPEC see_typename
2462 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2463 sorry ("non-virtual access");
2464 if ($$ == access_public_node)
2465 $$ = access_public_virtual_node;
2466 else if ($$ == access_private_node)
2467 $$ = access_private_virtual_node; }
2472 { tree t = $<ttype>0;
2473 push_obstacks_nochange ();
2474 end_temporary_allocation ();
2476 if (! IS_AGGR_TYPE (t))
2478 t = $<ttype>0 = make_lang_type (RECORD_TYPE);
2479 TYPE_NAME (t) = get_identifier ("erroneous type");
2482 duplicate_tag_error (t);
2483 if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
2485 t = make_lang_type (TREE_CODE (t));
2486 pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
2489 if (processing_template_decl && TYPE_CONTEXT (t)
2490 && ! current_class_type)
2491 push_template_decl (TYPE_STUB_DECL (t));
2493 TYPE_BEING_DEFINED (t) = 1;
2494 if (IS_AGGR_TYPE (t) && CLASSTYPE_USE_TEMPLATE (t))
2496 if (CLASSTYPE_IMPLICIT_INSTANTIATION (t)
2497 && TYPE_SIZE (t) == NULL_TREE)
2499 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
2500 if (processing_template_decl)
2501 push_template_decl (TYPE_MAIN_DECL (t));
2503 else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
2504 cp_error ("specialization after instantiation of `%T'", t);
2506 /* Reset the interface data, at the earliest possible
2507 moment, as it might have been set via a class foo;
2509 /* Don't change signatures. */
2510 if (! IS_SIGNATURE (t))
2512 extern tree pending_vtables;
2514 tree name = TYPE_IDENTIFIER (t);
2516 if (! ANON_AGGRNAME_P (name))
2518 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
2519 SET_CLASSTYPE_INTERFACE_UNKNOWN_X
2520 (t, interface_unknown);
2523 /* Record how to set the access of this class's
2524 virtual functions. If write_virtuals == 2 or 3, then
2525 inline virtuals are ``extern inline''. */
2526 switch (write_virtuals)
2533 needs_writing = !! value_member (name, pending_vtables);
2536 needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
2537 && CLASSTYPE_INTERFACE_KNOWN (t);
2542 CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
2545 t = TYPE_IDENTIFIER ($<ttype>0);
2546 if (t && IDENTIFIER_TEMPLATE (t))
2547 overload_template_name (t, 1);
2555 if (CLASSTYPE_TEMPLATE_INFO (current_class_type))
2558 $$ = build_self_reference ();
2562 opt.component_decl_list:
2564 { if ($$) $$ = build_tree_list (access_public_node, $$); }
2565 | self_reference component_decl_list
2567 if (current_aggr == signature_type_node)
2568 $$ = build_tree_list (access_public_node, $2);
2570 $$ = build_tree_list (access_default_node, $2);
2571 if ($1) $$ = tree_cons (access_public_node, $1, $$);
2573 | opt.component_decl_list VISSPEC ':' component_decl_list
2577 if (current_aggr == signature_type_node)
2579 error ("access specifier not allowed in signature");
2580 visspec = access_public_node;
2582 $$ = chainon ($$, build_tree_list (visspec, $4));
2584 | opt.component_decl_list VISSPEC ':'
2586 if (current_aggr == signature_type_node)
2587 error ("access specifier not allowed in signature");
2591 /* Note: we no longer warn about the semicolon after a component_decl_list.
2592 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2593 component_decl_list:
2595 { if ($$ == void_type_node) $$ = NULL_TREE;
2597 | component_decl_list component_decl
2598 { /* In pushdecl, we created a reverse list of names
2599 in this binding level. Make sure that the chain
2600 of what we're trying to add isn't the item itself
2601 (which can happen with what pushdecl's doing). */
2602 if ($2 != NULL_TREE && $2 != void_type_node)
2604 if (TREE_CHAIN ($2) != $$)
2605 $$ = chainon ($$, $2);
2613 component_decl_1 ';'
2615 | component_decl_1 '}'
2616 { error ("missing ';' before right brace");
2617 yyungetc ('}', 0); }
2618 /* C++: handle constructors, destructors and inline functions */
2619 /* note that INLINE is like a TYPESPEC */
2620 | fn.def2 ':' /* base_init compstmt */
2621 { $$ = finish_method ($$); }
2622 | fn.def2 TRY /* base_init compstmt */
2623 { $$ = finish_method ($$); }
2624 | fn.def2 RETURN /* base_init compstmt */
2625 { $$ = finish_method ($$); }
2626 | fn.def2 '{' /* nodecls compstmt */
2627 { $$ = finish_method ($$); }
2633 /* Do not add a "typed_declspecs declarator" rule here for
2634 speed; we need to call grok_x_components for enums, so the
2635 speedup would be insignificant. */
2636 typed_declspecs components
2637 { $$ = grok_x_components ($1.t, $2); }
2638 | declmods notype_components
2639 { $$ = grok_x_components ($1, $2); }
2640 | notype_declarator maybeasm maybe_attribute maybe_init
2641 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2642 build_tree_list ($3, NULL_TREE)); }
2643 | constructor_declarator maybeasm maybe_attribute maybe_init
2644 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2645 build_tree_list ($3, NULL_TREE)); }
2646 | ':' expr_no_commas
2647 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2651 /* These rules introduce a reduce/reduce conflict; in
2652 typedef int foo, bar;
2656 should "A::foo" be declared as a function or "A::bar" as a data
2657 member? In other words, is "bar" an after_type_declarator or a
2659 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2660 { tree specs, attrs;
2661 split_specs_attrs ($1, &specs, &attrs);
2662 $$ = grokfield ($2, specs, $5, $3,
2663 build_tree_list ($4, attrs)); }
2664 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2665 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2666 build_tree_list ($3, NULL_TREE)); }
2668 { $$ = do_class_using_decl ($1); }
2671 /* The case of exactly one component is handled directly by component_decl. */
2674 /* empty: possibly anonymous */
2676 | component_declarator0
2677 | components ',' component_declarator
2679 /* In this context, void_type_node encodes
2680 friends. They have been recorded elsewhere. */
2681 if ($$ == void_type_node)
2684 $$ = chainon ($$, $3);
2689 /* empty: possibly anonymous */
2691 | notype_component_declarator0
2692 | notype_components ',' notype_component_declarator
2694 /* In this context, void_type_node encodes
2695 friends. They have been recorded elsewhere. */
2696 if ($$ == void_type_node)
2699 $$ = chainon ($$, $3);
2703 component_declarator0:
2704 after_type_component_declarator0
2705 | notype_component_declarator0
2708 component_declarator:
2709 after_type_component_declarator
2710 | notype_component_declarator
2713 after_type_component_declarator0:
2714 after_type_declarator maybeasm maybe_attribute maybe_init
2715 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2716 &prefix_attributes);
2717 $<ttype>0 = current_declspecs;
2718 $$ = grokfield ($$, current_declspecs, $4, $2,
2719 build_tree_list ($3, prefix_attributes)); }
2720 | TYPENAME ':' expr_no_commas maybe_attribute
2721 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2722 &prefix_attributes);
2723 $<ttype>0 = current_declspecs;
2724 $$ = grokbitfield ($$, current_declspecs, $3);
2725 cplus_decl_attributes ($$, $4, prefix_attributes); }
2728 notype_component_declarator0:
2729 notype_declarator maybeasm maybe_attribute maybe_init
2730 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2731 &prefix_attributes);
2732 $<ttype>0 = current_declspecs;
2733 $$ = grokfield ($$, current_declspecs, $4, $2,
2734 build_tree_list ($3, prefix_attributes)); }
2735 | constructor_declarator maybeasm maybe_attribute maybe_init
2736 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2737 &prefix_attributes);
2738 $<ttype>0 = current_declspecs;
2739 $$ = grokfield ($$, current_declspecs, $4, $2,
2740 build_tree_list ($3, prefix_attributes)); }
2741 | IDENTIFIER ':' expr_no_commas maybe_attribute
2742 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2743 &prefix_attributes);
2744 $<ttype>0 = current_declspecs;
2745 $$ = grokbitfield ($$, current_declspecs, $3);
2746 cplus_decl_attributes ($$, $4, prefix_attributes); }
2747 | ':' expr_no_commas maybe_attribute
2748 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2749 &prefix_attributes);
2750 $<ttype>0 = current_declspecs;
2751 $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2752 cplus_decl_attributes ($$, $3, prefix_attributes); }
2755 after_type_component_declarator:
2756 after_type_declarator maybeasm maybe_attribute maybe_init
2757 { $$ = grokfield ($$, current_declspecs, $4, $2,
2758 build_tree_list ($3, prefix_attributes)); }
2759 | TYPENAME ':' expr_no_commas maybe_attribute
2760 { $$ = grokbitfield ($$, current_declspecs, $3);
2761 cplus_decl_attributes ($$, $4, prefix_attributes); }
2764 notype_component_declarator:
2765 notype_declarator maybeasm maybe_attribute maybe_init
2766 { $$ = grokfield ($$, current_declspecs, $4, $2,
2767 build_tree_list ($3, prefix_attributes)); }
2768 | IDENTIFIER ':' expr_no_commas maybe_attribute
2769 { $$ = grokbitfield ($$, current_declspecs, $3);
2770 cplus_decl_attributes ($$, $4, prefix_attributes); }
2771 | ':' expr_no_commas maybe_attribute
2772 { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2773 cplus_decl_attributes ($$, $3, prefix_attributes); }
2776 /* We chain the enumerators in reverse order.
2777 Because of the way enums are built, the order is
2778 insignificant. Take advantage of this fact. */
2782 | enumlist ',' enumerator
2783 { TREE_CHAIN ($3) = $$; $$ = $3; }
2788 { $$ = build_enumerator ($$, NULL_TREE); }
2789 | identifier '=' expr_no_commas
2790 { $$ = build_enumerator ($$, $3); }
2793 /* ANSI new-type-id (5.3.4) */
2795 type_specifier_seq new_declarator
2796 { $$.t = build_decl_list ($1.t, $2);
2797 $$.new_type_flag = $1.new_type_flag; }
2798 | type_specifier_seq %prec EMPTY
2799 { $$.t = build_decl_list ($1.t, NULL_TREE);
2800 $$.new_type_flag = $1.new_type_flag; }
2801 /* GNU extension to allow arrays of arbitrary types with
2802 non-constant dimension. */
2803 | '(' type_id ')' '[' expr ']'
2806 pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
2807 $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
2808 $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
2809 $$.new_type_flag = $2.new_type_flag;
2814 /* empty */ %prec EMPTY
2816 | cv_qualifiers CV_QUALIFIER
2817 { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
2820 nonempty_cv_qualifiers:
2822 { $$.t = IDENTIFIER_AS_LIST ($1);
2823 $$.new_type_flag = 0; }
2824 | nonempty_cv_qualifiers CV_QUALIFIER
2825 { $$.t = decl_tree_cons (NULL_TREE, $2, $1.t);
2826 $$.new_type_flag = $1.new_type_flag; }
2829 /* These rules must follow the rules for function declarations
2830 and component declarations. That way, longer rules are preferred. */
2834 { $<itype>$ = suspend_momentary (); }
2836 /* An expression which will not live on the momentary obstack. */
2839 { resume_momentary ((int) $<itype>1); $$ = $2; }
2842 /* An expression which will not live on the momentary obstack. */
2844 suspend_mom '(' nonnull_exprlist ')'
2845 { resume_momentary ((int) $<itype>1); $$ = $3; }
2846 | suspend_mom '(' parmlist ')'
2847 { resume_momentary ((int) $<itype>1); $$ = $3; }
2848 | suspend_mom LEFT_RIGHT
2849 { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
2850 | suspend_mom '(' error ')'
2851 { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
2854 /* A declarator that is allowed only after an explicit typespec. */
2855 /* may all be followed by prec '.' */
2856 after_type_declarator:
2857 '*' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2858 { $$ = make_pointer_declarator ($2.t, $3); }
2859 | '&' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2860 { $$ = make_reference_declarator ($2.t, $3); }
2861 | '*' after_type_declarator %prec UNARY
2862 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2863 | '&' after_type_declarator %prec UNARY
2864 { $$ = make_reference_declarator (NULL_TREE, $2); }
2865 | ptr_to_mem cv_qualifiers after_type_declarator
2866 { tree arg = make_pointer_declarator ($2, $3);
2867 $$ = build_parse_node (SCOPE_REF, $1, arg);
2869 | direct_after_type_declarator
2873 type_name %prec EMPTY
2875 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2877 if (current_class_type
2878 && TYPE_BEING_DEFINED (current_class_type)
2879 && ! IDENTIFIER_CLASS_VALUE ($1))
2881 /* Be sure to get an inherited typedef. */
2882 $$ = lookup_name ($1, 1);
2883 /* Remember that this name has been used in the class
2884 definition, as per [class.scope0] */
2885 pushdecl_class_level ($$);
2888 $$ = identifier_typedecl_value ($1);
2893 | global_scope type_name
2895 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2896 $$ = identifier_typedecl_value ($2);
2899 got_scope = NULL_TREE;
2902 | global_scope nested_type
2907 nested_name_specifier type_name %prec EMPTY
2908 { $$ = get_type_decl ($2); }
2911 direct_after_type_declarator:
2912 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2913 { $$ = make_call_declarator ($$, $2, $3, $4); }
2914 | direct_after_type_declarator '[' nonmomentary_expr ']'
2915 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2916 | direct_after_type_declarator '[' ']'
2917 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2918 | '(' after_type_declarator ')'
2920 | nested_name_specifier type_name %prec EMPTY
2921 { push_nested_class ($1, 3);
2922 $$ = build_parse_node (SCOPE_REF, $$, $2);
2923 TREE_COMPLEXITY ($$) = current_class_depth; }
2924 | type_name %prec EMPTY
2927 /* A declarator allowed whether or not there has been
2928 an explicit typespec. These cannot redeclare a typedef-name. */
2931 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2932 { $$ = make_pointer_declarator ($2.t, $3); }
2933 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2934 { $$ = make_reference_declarator ($2.t, $3); }
2935 | '*' notype_declarator %prec UNARY
2936 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2937 | '&' notype_declarator %prec UNARY
2938 { $$ = make_reference_declarator (NULL_TREE, $2); }
2939 | ptr_to_mem cv_qualifiers notype_declarator
2940 { tree arg = make_pointer_declarator ($2, $3);
2941 $$ = build_parse_node (SCOPE_REF, $1, arg);
2943 | direct_notype_declarator
2946 complex_notype_declarator:
2947 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2948 { $$ = make_pointer_declarator ($2.t, $3); }
2949 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2950 { $$ = make_reference_declarator ($2.t, $3); }
2951 | '*' complex_notype_declarator %prec UNARY
2952 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2953 | '&' complex_notype_declarator %prec UNARY
2954 { $$ = make_reference_declarator (NULL_TREE, $2); }
2955 | ptr_to_mem cv_qualifiers notype_declarator
2956 { tree arg = make_pointer_declarator ($2, $3);
2957 $$ = build_parse_node (SCOPE_REF, $1, arg);
2959 | complex_direct_notype_declarator
2962 complex_direct_notype_declarator:
2963 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2964 { $$ = make_call_declarator ($$, $2, $3, $4); }
2965 | '(' complex_notype_declarator ')'
2967 | direct_notype_declarator '[' nonmomentary_expr ']'
2968 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2969 | direct_notype_declarator '[' ']'
2970 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2971 | notype_qualified_id
2972 { if (OP0 ($$) != current_class_type)
2974 push_nested_class (OP0 ($$), 3);
2975 TREE_COMPLEXITY ($$) = current_class_depth;
2981 nested_name_specifier unqualified_id
2982 { got_scope = NULL_TREE;
2983 $$ = build_parse_node (SCOPE_REF, $$, $2); }
2986 notype_qualified_id:
2987 nested_name_specifier notype_unqualified_id
2988 { got_scope = NULL_TREE;
2989 $$ = build_parse_node (SCOPE_REF, $$, $2); }
2994 | global_scope notype_qualified_id
2999 typespec '(' nonnull_exprlist ')'
3000 { $$ = build_functional_cast ($1.t, $3); }
3001 | typespec '(' expr_or_declarator ')'
3002 { $$ = reparse_decl_as_expr ($1.t, $3); }
3003 | typespec fcast_or_absdcl %prec EMPTY
3004 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3010 | template_type %prec EMPTY
3013 nested_name_specifier:
3014 nested_name_specifier_1
3015 | nested_name_specifier nested_name_specifier_1
3019 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3020 inline here?!? (jason) */
3021 nested_name_specifier_1:
3024 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3027 /* Remember that this name has been used in the class
3028 definition, as per [class.scope0] */
3029 if (current_class_type
3030 && TYPE_BEING_DEFINED (current_class_type)
3031 && ! IDENTIFIER_CLASS_VALUE ($1))
3032 pushdecl_class_level ($$);
3034 got_scope = $$ = TREE_TYPE ($$);
3038 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3040 got_scope = $$ = TREE_TYPE ($$);
3043 { got_scope = $$ = $1; }
3044 | template_type SCOPE
3045 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3046 /* These break 'const i;'
3050 cp_error ("`%D' is not an aggregate typedef",
3051 lastiddecl ? lastiddecl : $$);
3052 $$ = error_mark_node;
3055 { goto failed_scope; } */
3059 global_scope type_name
3061 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3062 $$ = identifier_typedecl_value ($2);
3065 got_scope = NULL_TREE;
3068 | global_scope nested_type
3073 nested_name_specifier '*'
3074 { got_scope = NULL_TREE; }
3075 | global_scope nested_name_specifier '*'
3076 { $$ = $2; got_scope = NULL_TREE; }
3079 /* All uses of explicit global scope must go through this nonterminal so
3080 that got_scope will be set before yylex is called to get the next token. */
3083 { got_scope = void_type_node; }
3086 /* ANSI new-declarator (5.3.4) */
3088 '*' cv_qualifiers new_declarator
3089 { $$ = make_pointer_declarator ($2, $3); }
3090 | '*' cv_qualifiers %prec EMPTY
3091 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3092 | '&' cv_qualifiers new_declarator %prec EMPTY
3093 { $$ = make_reference_declarator ($2, $3); }
3094 | '&' cv_qualifiers %prec EMPTY
3095 { $$ = make_reference_declarator ($2, NULL_TREE); }
3096 | ptr_to_mem cv_qualifiers %prec EMPTY
3097 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3098 $$ = build_parse_node (SCOPE_REF, $1, arg);
3100 | ptr_to_mem cv_qualifiers new_declarator
3101 { tree arg = make_pointer_declarator ($2, $3);
3102 $$ = build_parse_node (SCOPE_REF, $1, arg);
3104 | direct_new_declarator %prec EMPTY
3107 /* ANSI direct-new-declarator (5.3.4) */
3108 direct_new_declarator:
3110 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3111 | direct_new_declarator '[' nonmomentary_expr ']'
3112 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3115 /* ANSI abstract-declarator (8.1) */
3117 '*' nonempty_cv_qualifiers absdcl
3118 { $$ = make_pointer_declarator ($2.t, $3); }
3120 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3121 | '*' nonempty_cv_qualifiers %prec EMPTY
3122 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3124 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3125 | '&' nonempty_cv_qualifiers absdcl
3126 { $$ = make_reference_declarator ($2.t, $3); }
3128 { $$ = make_reference_declarator (NULL_TREE, $2); }
3129 | '&' nonempty_cv_qualifiers %prec EMPTY
3130 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3132 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3133 | ptr_to_mem cv_qualifiers %prec EMPTY
3134 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3135 $$ = build_parse_node (SCOPE_REF, $1, arg);
3137 | ptr_to_mem cv_qualifiers absdcl
3138 { tree arg = make_pointer_declarator ($2, $3);
3139 $$ = build_parse_node (SCOPE_REF, $1, arg);
3141 | direct_abstract_declarator %prec EMPTY
3144 /* ANSI direct-abstract-declarator (8.1) */
3145 direct_abstract_declarator:
3148 /* `(typedef)1' is `int'. */
3150 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3151 { $$ = make_call_declarator ($$, $3, $5, $6); }
3152 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3153 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3154 | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
3155 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3156 | direct_abstract_declarator '[' ']' %prec '.'
3157 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3158 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3159 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3160 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3161 { set_quals_and_spec ($$, $2, $3); }
3162 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3163 { set_quals_and_spec ($$, $2, $3); }
3164 | '[' nonmomentary_expr ']' %prec '.'
3165 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3167 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
3170 /* For C++, decls and stmts can be intermixed, so we don't need to
3171 have a special rule that won't start parsing the stmt section
3172 until we have a stmt that parses without errors. */
3185 /* build the LET_STMT node before parsing its contents,
3186 so that any LET_STMTs within the context can have their display pointers
3187 set up to point at this one. */
3191 { do_pushlevel (); }
3196 { $$ = do_poplevel (); }
3199 /* Read zero or more forward-declarations for labels
3200 that nested functions can jump to. */
3205 pedwarn ("ANSI C++ forbids label declarations"); }
3210 | label_decls label_decl
3214 LABEL identifiers_or_typenames ';'
3216 for (link = $2; link; link = TREE_CHAIN (link))
3218 tree label = shadow_label (TREE_VALUE (link));
3219 C_DECLARED_LABEL_FLAG (label) = 1;
3220 declare_nonlocal_label (label);
3225 /* This is the body of a function definition.
3226 It causes syntax errors to ignore to the next openbrace. */
3236 if (processing_template_decl)
3238 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3239 add_tree ($<ttype>$);
3242 .pushlevel compstmtend .poplevel
3244 if (processing_template_decl)
3246 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3247 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3248 last_tree = $<ttype>2;
3257 if (processing_template_decl)
3259 $<ttype>$ = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE,
3261 add_tree ($<ttype>$);
3263 cond_stmt_keyword = "if";
3265 .pushlevel paren_cond_or_null
3267 if (processing_template_decl)
3269 if (last_tree != $<ttype>2)
3271 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3272 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3273 last_tree = $<ttype>2;
3276 TREE_OPERAND ($<ttype>2, 0) = $4;
3280 emit_line_note (input_filename, lineno);
3281 expand_start_cond ($4, 0);
3284 implicitly_scoped_stmt
3286 if (processing_template_decl)
3288 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3289 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3290 $<ttype>$ = last_tree = $<ttype>2;
3295 implicitly_scoped_stmt:
3300 if (processing_template_decl)
3302 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3303 add_tree ($<ttype>$);
3306 simple_stmt .poplevel
3308 if (processing_template_decl)
3310 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3311 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3312 last_tree = $<ttype>2;
3330 if (! processing_template_decl)
3332 emit_line_note (input_filename, lineno);
3333 /* Do default conversion if safe and possibly important,
3334 in case within ({...}). */
3335 if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
3337 || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
3338 expr = default_conversion (expr);
3340 cplus_expand_expr_stmt (expr);
3344 { if (! processing_template_decl) expand_start_else (); }
3345 implicitly_scoped_stmt
3347 if (processing_template_decl)
3349 TREE_OPERAND ($<ttype>1, 2) = TREE_CHAIN ($<ttype>1);
3350 TREE_CHAIN ($<ttype>1) = NULL_TREE;
3351 last_tree = $<ttype>1;
3358 | simple_if %prec IF
3359 { if (! processing_template_decl) expand_end_cond ();
3364 if (processing_template_decl)
3366 $<ttype>$ = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
3367 add_tree ($<ttype>$);
3372 emit_line_note (input_filename, lineno);
3373 expand_start_loop (1);
3375 cond_stmt_keyword = "while";
3377 .pushlevel paren_cond_or_null
3379 if (processing_template_decl)
3381 if (last_tree != $<ttype>2)
3383 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3384 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3385 last_tree = $<ttype>2;
3388 TREE_OPERAND ($<ttype>2, 0) = $4;
3392 emit_line_note (input_filename, lineno);
3393 expand_exit_loop_if_false (0, $4);
3396 already_scoped_stmt .poplevel
3398 if (processing_template_decl)
3400 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3401 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3402 last_tree = $<ttype>2;
3410 if (processing_template_decl)
3412 $<ttype>$ = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
3413 add_tree ($<ttype>$);
3418 emit_line_note (input_filename, lineno);
3419 expand_start_loop_continue_elsewhere (1);
3422 implicitly_scoped_stmt WHILE
3424 if (processing_template_decl)
3426 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3427 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3428 last_tree = $<ttype>2;
3432 expand_loop_continue_here ();
3433 cond_stmt_keyword = "do";
3436 paren_expr_or_null ';'
3438 if (processing_template_decl)
3439 TREE_OPERAND ($<ttype>2, 1) = $6;
3442 emit_line_note (input_filename, lineno);
3443 expand_exit_loop_if_false (0, $6);
3450 { if (processing_template_decl)
3452 $<ttype>$ = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
3453 NULL_TREE, NULL_TREE);
3454 add_tree ($<ttype>$);
3457 emit_line_note (input_filename, lineno);
3458 if (flag_new_for_scope > 0)
3460 /* Conditionalize .pushlevel */
3462 note_level_for_for ();
3465 expand_start_bindings (0);
3468 '(' for.init.statement
3470 if (processing_template_decl)
3472 if (last_tree != $<ttype>2)
3474 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3475 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3476 last_tree = $<ttype>2;
3482 emit_line_note (input_filename, lineno);
3483 expand_start_loop_continue_elsewhere (1);
3486 .pushlevel xcond ';'
3488 if (processing_template_decl)
3490 if (last_tree != $<ttype>2)
3492 TREE_OPERAND ($<ttype>2, 1) = last_tree;
3493 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3494 last_tree = $<ttype>2;
3497 TREE_OPERAND ($<ttype>2, 1) = $7;
3501 emit_line_note (input_filename, lineno);
3502 if ($7) expand_exit_loop_if_false (0, $7);
3506 /* Don't let the tree nodes for $10 be discarded
3507 by clear_momentary during the parsing of the next stmt. */
3509 if (processing_template_decl)
3510 TREE_OPERAND ($<ttype>2, 2) = $10;
3513 already_scoped_stmt .poplevel
3515 if (processing_template_decl)
3517 TREE_OPERAND ($<ttype>2, 3) = TREE_CHAIN ($<ttype>2);
3518 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3519 last_tree = $<ttype>2;
3523 emit_line_note (input_filename, lineno);
3524 expand_loop_continue_here ();
3525 if ($10) cplus_expand_expr_stmt ($10);
3529 if (flag_new_for_scope > 0)
3534 | SWITCH .pushlevel '(' condition ')'
3536 if (processing_template_decl)
3538 $<ttype>$ = build_min_nt (SWITCH_STMT, $4, NULL_TREE);
3539 add_tree ($<ttype>$);
3543 emit_line_note (input_filename, lineno);
3544 c_expand_start_case ($4);
3547 /* Don't let the tree nodes for $4 be discarded by
3548 clear_momentary during the parsing of the next stmt. */
3551 implicitly_scoped_stmt
3553 if (processing_template_decl)
3555 TREE_OPERAND ($<ttype>6, 1) = TREE_CHAIN ($<ttype>6);
3556 TREE_CHAIN ($<ttype>6) = NULL_TREE;
3557 last_tree = $<ttype>6;
3560 expand_end_case ($4);
3566 | CASE expr_no_commas ':'
3567 { do_case ($2, NULL_TREE); }
3569 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3570 { do_case ($2, $4); }
3573 { do_case (NULL_TREE, NULL_TREE); }
3576 { emit_line_note (input_filename, lineno);
3577 if (processing_template_decl)
3578 add_tree (build_min_nt (BREAK_STMT));
3579 else if ( ! expand_exit_something ())
3580 error ("break statement not within loop or switch"); }
3582 { emit_line_note (input_filename, lineno);
3583 if (processing_template_decl)
3584 add_tree (build_min_nt (CONTINUE_STMT));
3585 else if (! expand_continue_loop (0))
3586 error ("continue statement not within a loop"); }
3588 { emit_line_note (input_filename, lineno);
3589 c_expand_return (NULL_TREE); }
3591 { emit_line_note (input_filename, lineno);
3592 c_expand_return ($2);
3595 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3596 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3597 emit_line_note (input_filename, lineno);
3601 /* This is the case with just output operands. */
3602 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3603 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3604 emit_line_note (input_filename, lineno);
3605 c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
3606 $2 == ridpointers[(int)RID_VOLATILE],
3607 input_filename, lineno);
3610 /* This is the case with input operands as well. */
3611 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
3612 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3613 emit_line_note (input_filename, lineno);
3614 c_expand_asm_operands ($4, $6, $8, NULL_TREE,
3615 $2 == ridpointers[(int)RID_VOLATILE],
3616 input_filename, lineno);
3619 /* This is the case with clobbered registers as well. */
3620 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3621 asm_operands ':' asm_clobbers ')' ';'
3622 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3623 emit_line_note (input_filename, lineno);
3624 c_expand_asm_operands ($4, $6, $8, $10,
3625 $2 == ridpointers[(int)RID_VOLATILE],
3626 input_filename, lineno);
3631 if (processing_template_decl)
3632 add_tree (build_min_nt (GOTO_STMT, $3));
3634 { emit_line_note (input_filename, lineno);
3635 expand_computed_goto ($3); }
3637 | GOTO identifier ';'
3639 if (processing_template_decl)
3640 add_tree (build_min_nt (GOTO_STMT, $2));
3644 emit_line_note (input_filename, lineno);
3645 decl = lookup_label ($2);
3646 TREE_USED (decl) = 1;
3653 { error ("label must be followed by statement");
3664 if (! current_function_parms_stored)
3665 store_parm_decls ();
3666 expand_start_early_try_stmts ();
3668 ctor_initializer_opt compstmt_or_error
3669 { expand_start_all_catch (); }
3672 int nested = (hack_decl_function_context
3673 (current_function_decl) != NULL_TREE);
3674 expand_end_all_catch ();
3675 finish_function (lineno, (int)$3, nested);
3682 if (processing_template_decl)
3684 $<ttype>$ = build_min_nt (TRY_BLOCK, NULL_TREE,
3686 add_tree ($<ttype>$);
3690 emit_line_note (input_filename, lineno);
3691 expand_start_try_stmts ();
3696 if (processing_template_decl)
3698 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3699 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3700 last_tree = $<ttype>2;
3703 expand_start_all_catch ();
3707 if (processing_template_decl)
3709 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3710 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3711 last_tree = $<ttype>2;
3714 expand_end_all_catch ();
3722 if (processing_template_decl)
3724 $<ttype>$ = build_min_nt (HANDLER, NULL_TREE,
3726 add_tree ($<ttype>$);
3729 .pushlevel handler_args
3731 if (processing_template_decl)
3733 TREE_OPERAND ($<ttype>3, 0) = TREE_CHAIN ($<ttype>3);
3734 TREE_CHAIN ($<ttype>3) = NULL_TREE;
3735 last_tree = $<ttype>3;
3740 if (processing_template_decl)
3742 TREE_OPERAND ($<ttype>3, 1) = TREE_CHAIN ($<ttype>3);
3743 TREE_CHAIN ($<ttype>3) = NULL_TREE;
3744 last_tree = $<ttype>3;
3747 expand_end_catch_block ();
3753 typed_typespecs %prec EMPTY
3754 | nonempty_cv_qualifiers %prec EMPTY
3759 { expand_start_catch_block (NULL_TREE, NULL_TREE); }
3760 /* This doesn't allow reference parameters, the below does.
3761 | '(' type_specifier_seq absdcl ')'
3762 { check_for_new_type ("inside exception declarations", $2);
3763 expand_start_catch_block ($2.t, $3); }
3764 | '(' type_specifier_seq ')'
3765 { check_for_new_type ("inside exception declarations", $2);
3766 expand_start_catch_block ($2.t, NULL_TREE); }
3767 | '(' type_specifier_seq notype_declarator ')'
3768 { check_for_new_type ("inside exception declarations", $2);
3769 expand_start_catch_block ($2.t, $3); }
3770 | '(' typed_typespecs after_type_declarator ')'
3771 { check_for_new_type ("inside exception declarations", $2);
3772 expand_start_catch_block ($2.t, $3); }
3773 This allows reference parameters... */
3775 { check_for_new_type ("inside exception declarations", $2);
3776 expand_start_catch_block (TREE_PURPOSE ($2.t),
3777 TREE_VALUE ($2.t)); }
3784 label = define_label (input_filename, lineno, $1);
3785 if (label && ! minimal_parse_mode)
3786 expand_label (label);
3798 { if ($1) cplus_expand_expr_stmt ($1); }
3802 pedwarn ("ANSI C++ forbids compound statements inside for initializations");
3806 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3810 { emit_line_note (input_filename, lineno);
3813 { emit_line_note (input_filename, lineno); }
3824 /* These are the operands other than the first string and colon
3825 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3829 | nonnull_asm_operands
3832 nonnull_asm_operands:
3834 | nonnull_asm_operands ',' asm_operand
3835 { $$ = chainon ($$, $3); }
3840 { $$ = build_tree_list ($$, $3); }
3845 { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
3846 | asm_clobbers ',' STRING
3847 { $$ = tree_cons (NULL_TREE, $3, $$); }
3850 /* This is what appears inside the parens in a function declarator.
3851 Its value is represented in the format that grokdeclarator expects.
3853 In C++, declaring a function with no parameters
3854 means that that function takes *no* parameters. */
3863 { $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3864 TREE_PARMLIST ($$) = 1;
3865 check_for_new_type ("inside parameter list", $1); }
3868 /* This nonterminal does not include the common sequence '(' type_id ')',
3869 as it is ambiguous and must be disambiguated elsewhere. */
3873 $$ = chainon ($$, void_list_node);
3874 TREE_PARMLIST ($$) = 1;
3876 | parms_comma ELLIPSIS
3878 TREE_PARMLIST ($$) = 1;
3880 /* C++ allows an ellipsis without a separating ',' */
3883 TREE_PARMLIST ($$) = 1;
3887 $$ = build_tree_list (NULL_TREE, $1.t);
3888 TREE_PARMLIST ($$) = 1;
3896 TREE_PARMLIST ($$) = 1;
3898 | parms TYPENAME_ELLIPSIS
3900 TREE_PARMLIST ($$) = 1;
3902 | type_id TYPENAME_ELLIPSIS
3904 $$ = build_tree_list (NULL_TREE, $1.t);
3905 TREE_PARMLIST ($$) = 1;
3909 /* This helps us recover from really nasty
3910 parse errors, for example, a missing right
3912 yyerror ("possibly missing ')'");
3913 $$ = chainon ($$, void_list_node);
3914 TREE_PARMLIST ($$) = 1;
3920 /* This helps us recover from really nasty
3921 parse errors, for example, a missing right
3923 yyerror ("possibly missing ')'");
3924 $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3925 TREE_PARMLIST ($$) = 1;
3931 /* A nonempty list of parameter declarations or type names. */
3934 { check_for_new_type ("in a parameter list", $1);
3935 $$ = build_tree_list (NULL_TREE, $1.t); }
3937 { check_for_new_type ("in a parameter list", $1);
3938 $$ = build_tree_list ($3, $1.t); }
3939 | parms_comma full_parm
3940 { check_for_new_type ("in a parameter list", $2);
3941 $$ = chainon ($$, $2.t); }
3942 | parms_comma bad_parm
3943 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
3944 | parms_comma bad_parm '=' init
3945 { $$ = chainon ($$, build_tree_list ($4, $2)); }
3951 { check_for_new_type ("in a parameter list", $1);
3952 $$ = build_tree_list (NULL_TREE, $1.t); }
3955 /* A single parameter declaration or parameter type name,
3956 as found in a parmlist. */
3958 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3959 TYPESPEC IDENTIFIER. */
3960 typed_declspecs1 declarator
3961 { tree specs = strip_attrs ($1.t);
3962 $$.new_type_flag = $1.new_type_flag;
3963 $$.t = build_tree_list (specs, $2); }
3964 | typed_typespecs declarator
3965 { $$.t = build_tree_list ($1.t, $2);
3966 $$.new_type_flag = $1.new_type_flag; }
3967 | typespec declarator
3968 { $$.t = build_tree_list (get_decl_list ($1.t), $2);
3969 $$.new_type_flag = $1.new_type_flag; }
3970 | typed_declspecs1 absdcl
3971 { tree specs = strip_attrs ($1.t);
3972 $$.t = build_tree_list (specs, $2);
3973 $$.new_type_flag = $1.new_type_flag; }
3974 | typed_declspecs1 %prec EMPTY
3975 { tree specs = strip_attrs ($1.t);
3976 $$.t = build_tree_list (specs, NULL_TREE);
3977 $$.new_type_flag = $1.new_type_flag; }
3978 | declmods notype_declarator
3979 { tree specs = strip_attrs ($1);
3980 $$.t = build_tree_list (specs, $2);
3981 $$.new_type_flag = 0; }
3986 { $$.t = build_tree_list ($2, $1.t);
3987 $$.new_type_flag = $1.new_type_flag; }
3996 /* empty */ %prec EMPTY
3997 { see_typename (); }
4001 /* empty */ %prec EMPTY
4003 error ("type specifier omitted for parameter");
4004 $$ = build_tree_list (integer_type_node, NULL_TREE);
4008 error ("type specifier omitted for parameter");
4009 if (TREE_CODE ($$) == SCOPE_REF
4010 && TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM)
4011 cp_error (" perhaps you want `typename %E' to make it a type", $$);
4012 $$ = build_tree_list (integer_type_node, $$);
4016 exception_specification_opt:
4017 /* empty */ %prec EMPTY
4019 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
4021 | THROW LEFT_RIGHT %prec EMPTY
4022 { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
4025 ansi_raise_identifier:
4027 { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
4030 ansi_raise_identifiers:
4031 ansi_raise_identifier
4032 | ansi_raise_identifiers ',' ansi_raise_identifier
4034 TREE_CHAIN ($3) = $$;
4039 conversion_declarator:
4040 /* empty */ %prec EMPTY
4042 | '*' cv_qualifiers conversion_declarator
4043 { $$ = make_pointer_declarator ($2, $3); }
4044 | '&' cv_qualifiers conversion_declarator
4045 { $$ = make_reference_declarator ($2, $3); }
4046 | ptr_to_mem cv_qualifiers conversion_declarator
4047 { tree arg = make_pointer_declarator ($2, $3);
4048 $$ = build_parse_node (SCOPE_REF, $1, arg);
4054 { got_scope = NULL_TREE; }
4059 { $$ = ansi_opname[MULT_EXPR]; }
4061 { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
4063 { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
4065 { $$ = ansi_opname[PLUS_EXPR]; }
4067 { $$ = ansi_opname[MINUS_EXPR]; }
4069 { $$ = ansi_opname[BIT_AND_EXPR]; }
4071 { $$ = ansi_opname[BIT_IOR_EXPR]; }
4073 { $$ = ansi_opname[BIT_XOR_EXPR]; }
4075 { $$ = ansi_opname[BIT_NOT_EXPR]; }
4077 { $$ = ansi_opname[COMPOUND_EXPR]; }
4078 | operator ARITHCOMPARE
4079 { $$ = ansi_opname[$2]; }
4081 { $$ = ansi_opname[LT_EXPR]; }
4083 { $$ = ansi_opname[GT_EXPR]; }
4084 | operator EQCOMPARE
4085 { $$ = ansi_opname[$2]; }
4087 { $$ = ansi_assopname[$2]; }
4089 { $$ = ansi_opname [MODIFY_EXPR]; }
4091 { $$ = ansi_opname[$2]; }
4093 { $$ = ansi_opname[$2]; }
4095 { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
4096 | operator MINUSMINUS
4097 { $$ = ansi_opname[PREDECREMENT_EXPR]; }
4099 { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
4101 { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
4103 { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
4105 { $$ = ansi_opname[COND_EXPR]; }
4107 { $$ = ansi_opname[$2]; }
4108 | operator POINTSAT %prec EMPTY
4109 { $$ = ansi_opname[COMPONENT_REF]; }
4110 | operator POINTSAT_STAR %prec EMPTY
4111 { $$ = ansi_opname[MEMBER_REF]; }
4112 | operator LEFT_RIGHT
4113 { $$ = ansi_opname[CALL_EXPR]; }
4115 { $$ = ansi_opname[ARRAY_REF]; }
4116 | operator NEW %prec EMPTY
4117 { $$ = ansi_opname[NEW_EXPR]; }
4118 | operator DELETE %prec EMPTY
4119 { $$ = ansi_opname[DELETE_EXPR]; }
4120 | operator NEW '[' ']'
4121 { $$ = ansi_opname[VEC_NEW_EXPR]; }
4122 | operator DELETE '[' ']'
4123 { $$ = ansi_opname[VEC_DELETE_EXPR]; }
4124 /* Names here should be looked up in class scope ALSO. */
4125 | operator type_specifier_seq conversion_declarator
4126 { $$ = grokoptypename ($2.t, $3); }
4128 { $$ = ansi_opname[ERROR_MARK]; }
4135 debug_yytranslate (value)
4138 return yytname[YYTRANSLATE (value)];