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 /* Only go ahead with using the void list node if we're actually
93 parsing a class in C++, not a struct in extern "C" mode. */
94 || (current_class_type != NULL
95 && current_lang_name == lang_name_cplusplus))
96 parms = void_list_node;
105 %union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; }
107 /* All identifiers that are not reserved words
108 and are not declared typedefs in the current block */
111 /* All identifiers that are declared typedefs in the current block.
112 In some contexts, they are treated just like IDENTIFIER,
113 but they can also serve as typespecs in declarations. */
117 /* Reserved words that specify storage class.
118 yylval contains an IDENTIFIER_NODE which indicates which one. */
121 /* Reserved words that specify type.
122 yylval contains an IDENTIFIER_NODE which indicates which one. */
125 /* Reserved words that qualify type: "const" or "volatile".
126 yylval contains an IDENTIFIER_NODE which indicates which one. */
129 /* Character or numeric constants.
130 yylval is the node for the constant. */
133 /* String constants in raw form.
134 yylval is a STRING_CST node. */
137 /* "...", used for functions with variable arglists. */
140 /* the reserved words */
141 /* SCO include files test "ASM", so use something else. */
142 %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
143 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
145 %token ATTRIBUTE EXTENSION LABEL
146 %token REALPART IMAGPART
148 /* the reserved words... C++ extensions */
150 %token <ttype> VISSPEC
151 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
152 %token NAMESPACE TYPENAME_KEYWORD USING
153 %token LEFT_RIGHT TEMPLATE
154 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
157 /* Define the operator tokens and their precedences.
158 The value is an integer because, if used, it is the tree code
159 to use in the expression made from the operator. */
161 %left EMPTY /* used to resolve s/r with epsilon */
165 /* Add precedence rules to solve dangling else s/r conflict */
169 %left IDENTIFIER TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
175 %right <code> ASSIGN '='
183 %left <code> EQCOMPARE
184 %left <code> ARITHCOMPARE '<' '>'
185 %left <code> LSHIFT RSHIFT
187 %left <code> '*' '/' '%'
188 %left <code> POINTSAT_STAR DOT_STAR
189 %right <code> UNARY PLUSPLUS MINUSMINUS '~'
191 %left <ttype> PAREN_STAR_PAREN LEFT_RIGHT
192 %left <code> POINTSAT '.' '(' '['
194 %right SCOPE /* C++ extension */
195 %nonassoc NEW DELETE TRY CATCH
199 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
200 %type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
201 %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
202 %type <ttype> reserved_declspecs boolean.literal
203 %type <ttype> reserved_typespecquals
204 %type <ttype> declmods
205 %type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
206 %type <itype> initdecls notype_initdecls initdcl /* C++ modification */
207 %type <ttype> init initlist maybeasm maybe_init defarg defarg1
208 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
209 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
210 %type <ttype> any_word
212 %type <ttype> compstmt implicitly_scoped_stmt
214 %type <ttype> declarator notype_declarator after_type_declarator
215 %type <ttype> direct_notype_declarator direct_after_type_declarator
217 %type <ttype> opt.component_decl_list component_decl_list
218 %type <ttype> component_decl component_decl_1 components notype_components
219 %type <ttype> component_declarator component_declarator0 self_reference
220 %type <ttype> notype_component_declarator notype_component_declarator0
221 %type <ttype> after_type_component_declarator after_type_component_declarator0
222 %type <ttype> enumlist enumerator
223 %type <ttype> absdcl cv_qualifiers
224 %type <ttype> direct_abstract_declarator conversion_declarator
225 %type <ttype> new_declarator direct_new_declarator
226 %type <ttype> xexpr parmlist parms bad_parm
227 %type <ttype> identifiers_or_typenames
228 %type <ttype> fcast_or_absdcl regcast_or_absdcl
229 %type <ttype> expr_or_declarator complex_notype_declarator
230 %type <ttype> notype_unqualified_id unqualified_id qualified_id
231 %type <ttype> overqualified_id notype_qualified_id any_id
232 %type <ttype> complex_direct_notype_declarator functional_cast
233 %type <ttype> complex_parmlist parms_comma
235 %type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
236 %type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
237 %type <ftype> structsp typespecqual_reserved parm named_parm full_parm
240 %token <ttype> TYPENAME_ELLIPSIS PTYPENAME
241 %token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
242 %token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
243 %type <ttype> fn.def1 /* Not really! */ component_constructor_declarator
244 %type <ttype> fn.def2 return_id fn.defpen constructor_declarator
245 %type <itype> ctor_initializer_opt
246 %type <ttype> named_class_head named_class_head_sans_basetype
247 %type <ttype> named_complex_class_head_sans_basetype
248 %type <ttype> unnamed_class_head
249 %type <ttype> class_head base_class_list
250 %type <ttype> base_class_access_list
251 %type <ttype> base_class maybe_base_class_list base_class.1
252 %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
253 %type <ttype> operator_name
254 %type <ttype> object aggr
255 %type <itype> new delete
256 /* %type <ttype> primary_no_id */
257 %type <ttype> nonmomentary_expr maybe_parmlist
258 %type <itype> initdcl0 notype_initdcl0 member_init_list
259 %type <ttype> template_header template_parm_list template_parm
260 %type <ttype> template_type_parm
261 %type <code> template_close_bracket
262 %type <ttype> template_type template_arg_list template_arg
263 %type <ttype> condition xcond paren_cond_or_null
264 %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
265 %type <ttype> complete_type_name notype_identifier
266 %type <ttype> complex_type_name nested_name_specifier_1
267 %type <itype> nomods_initdecls nomods_initdcl0
268 %type <ttype> new_initializer new_placement
269 %type <ttype> using_decl .poplevel
271 /* in order to recognize aggr tags as defining and thus shadowing. */
272 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
273 %type <ttype> named_class_head_sans_basetype_defn
274 %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
276 %type <ttype> self_template_type
281 /* Used in lex.c for parsing pragmas. */
284 /* lex.c and pt.c depend on this being the last token. Define
285 any new tokens before this one! */
286 %token END_OF_SAVED_INPUT
289 /* List of types and structure classes of the current declaration. */
290 static tree current_declspecs = NULL_TREE;
291 /* List of prefix attributes in effect.
292 Prefix attributes are parsed by the reserved_declspecs and declmods
293 rules. They create a list that contains *both* declspecs and attrs. */
294 /* ??? It is not clear yet that all cases where an attribute can now appear in
295 a declspec list have been updated. */
296 static tree prefix_attributes = NULL_TREE;
298 /* When defining an aggregate, this is the most recent one being defined. */
299 static tree current_aggr;
301 /* Tell yyparse how to print a token's value, if yydebug is set. */
303 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
304 extern void yyprint ();
305 extern tree combine_strings PROTO((tree));
313 /* In case there were missing closebraces,
314 get us back to the global binding level. */
315 while (! global_bindings_p ())
321 /* the reason for the strange actions in this rule
322 is so that notype_initdecls when reached via datadef
323 can find a valid list of type and sc specs in $0. */
326 { $<ttype>$ = NULL_TREE; }
328 { $<ttype>$ = NULL_TREE; }
329 | extdefs lang_extdef
330 { $<ttype>$ = NULL_TREE; }
339 { have_extern_spec = 1;
340 used_extern_spec = 0;
341 $<ttype>$ = NULL_TREE; }
344 { have_extern_spec = 0; }
349 { $<itype>$ = pedantic;
359 { if (pending_lang_change) do_pending_lang_change(); }
361 { if (! toplevel_bindings_p () && ! pseudo_global_level_p())
367 { if (pending_inlines) do_pending_inlines (); }
369 { if (pending_inlines) do_pending_inlines (); }
371 { if (pending_inlines) do_pending_inlines (); }
372 | asm_keyword '(' string ')' ';'
373 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
375 | extern_lang_string '{' extdefs_opt '}'
376 { pop_lang_context (); }
377 | extern_lang_string .hush_warning fndef .warning_ok
378 { if (pending_inlines) do_pending_inlines ();
379 pop_lang_context (); }
380 | extern_lang_string .hush_warning datadef .warning_ok
381 { if (pending_inlines) do_pending_inlines ();
382 pop_lang_context (); }
383 | NAMESPACE identifier '{'
384 { push_namespace ($2); }
386 { pop_namespace (); }
388 { push_namespace (NULL_TREE); }
390 { pop_namespace (); }
391 | NAMESPACE identifier '=' any_id ';'
392 { do_namespace_alias ($2, $4); }
394 { do_toplevel_using_decl ($1); }
395 | USING NAMESPACE any_id ';'
397 if (TREE_CODE ($3) == IDENTIFIER_NODE)
399 do_using_directive ($3);
402 { pedantic = $<itype>1; }
408 | USING global_scope qualified_id
410 | USING global_scope unqualified_id
417 | global_scope qualified_id
419 | global_scope unqualified_id
425 { push_lang_context ($1); }
426 | extern_lang_string EXTERN_LANG_STRING
427 { if (current_lang_name != $2)
428 cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
429 pop_lang_context (); push_lang_context ($2); }
434 { begin_template_parm_list (); }
435 template_parm_list '>'
436 { $$ = end_template_parm_list ($4); }
443 { $$ = process_template_parm (NULL_TREE, $1); }
444 | template_parm_list ',' template_parm
445 { $$ = process_template_parm ($1, $3); }
451 $$ = build_tree_list ($1, NULL_TREE);
453 if (TREE_PURPOSE ($$) == signature_type_node)
454 sorry ("signature as template type parameter");
455 else if (TREE_PURPOSE ($$) != class_type_node)
457 pedwarn ("template type parameters must use the keyword `class'");
458 TREE_PURPOSE ($$) = class_type_node;
462 { $$ = build_tree_list ($1, $2); goto ttpa; }
464 { $$ = build_tree_list (class_type_node, NULL_TREE); }
465 | TYPENAME_KEYWORD identifier
466 { $$ = build_tree_list (class_type_node, $2); }
470 /* The following rules introduce a new reduce/reduce
471 conflict on the ',' and '>' input tokens: they are valid
472 prefixes for a `structsp', which means they could match a
473 nameless parameter. See 14.6, paragraph 3.
474 By putting them before the `parm' rule, we get
475 their match before considering them nameless parameter
478 { $$ = build_tree_list (NULL_TREE, $1); }
479 | template_type_parm '=' type_id
480 { $$ = build_tree_list (groktypename ($3.t), $1); }
482 { $$ = build_tree_list (NULL_TREE, $1.t); }
483 | parm '=' expr_no_commas %prec ARITHCOMPARE
484 { $$ = build_tree_list ($3, $1.t); }
490 { end_template_decl (); }
493 { end_template_decl (); }
499 | declmods notype_initdecls ';'
501 | typed_declspecs initdecls ';'
503 note_list_got_semicolon ($1.t);
506 { pedwarn ("empty declaration"); }
507 | explicit_instantiation ';'
508 | typed_declspecs ';'
511 split_specs_attrs ($1.t, &t, &attrs);
513 note_list_got_semicolon ($1.t);
520 ctor_initializer_opt:
539 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
540 { finish_function (lineno, (int)$3, 0); }
541 | fn.def1 maybe_return_init function_try_block
542 { if ($<ttype>$) process_next_inline ($<ttype>$); }
546 constructor_declarator:
547 nested_name_specifier SELFNAME '('
549 $$ = build_parse_node (SCOPE_REF, $1, $2);
550 if ($1 != current_class_type)
552 push_nested_class ($1, 3);
553 TREE_COMPLEXITY ($$) = current_class_depth;
556 parmlist ')' cv_qualifiers exception_specification_opt
557 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
558 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
560 $$ = build_parse_node (SCOPE_REF, $1, $2);
561 if ($1 != current_class_type)
563 push_nested_class ($1, 3);
564 TREE_COMPLEXITY ($$) = current_class_depth;
566 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
568 | global_scope nested_name_specifier SELFNAME '('
570 $$ = build_parse_node (SCOPE_REF, $2, $3);
571 if ($2 != current_class_type)
573 push_nested_class ($2, 3);
574 TREE_COMPLEXITY ($$) = current_class_depth;
577 parmlist ')' cv_qualifiers exception_specification_opt
578 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
579 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
581 $$ = build_parse_node (SCOPE_REF, $2, $3);
582 if ($2 != current_class_type)
584 push_nested_class ($2, 3);
585 TREE_COMPLEXITY ($$) = current_class_depth;
587 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
589 | nested_name_specifier self_template_type '('
591 $$ = build_parse_node (SCOPE_REF, $1, $2);
592 if ($1 != current_class_type)
594 push_nested_class ($1, 3);
595 TREE_COMPLEXITY ($$) = current_class_depth;
598 parmlist ')' cv_qualifiers exception_specification_opt
599 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
600 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
602 $$ = build_parse_node (SCOPE_REF, $1, $2);
603 if ($1 != current_class_type)
605 push_nested_class ($1, 3);
606 TREE_COMPLEXITY ($$) = current_class_depth;
608 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
610 | global_scope nested_name_specifier self_template_type '('
612 $$ = build_parse_node (SCOPE_REF, $2, $3);
613 if ($2 != current_class_type)
615 push_nested_class ($2, 3);
616 TREE_COMPLEXITY ($$) = current_class_depth;
619 parmlist ')' cv_qualifiers exception_specification_opt
620 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
621 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
623 $$ = build_parse_node (SCOPE_REF, $2, $3);
624 if ($2 != current_class_type)
626 push_nested_class ($2, 3);
627 TREE_COMPLEXITY ($$) = current_class_depth;
629 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
634 typed_declspecs declarator
636 split_specs_attrs ($1.t, &specs, &attrs);
637 if (! start_function (specs, $2, attrs, 0))
639 reinit_parse_for_function ();
641 | declmods notype_declarator
643 split_specs_attrs ($1, &specs, &attrs);
644 if (! start_function (specs, $2, attrs, 0))
646 reinit_parse_for_function ();
649 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
651 reinit_parse_for_function ();
653 | declmods constructor_declarator
655 split_specs_attrs ($1, &specs, &attrs);
656 if (! start_function (specs, $2, attrs, 0))
658 reinit_parse_for_function ();
660 | constructor_declarator
661 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
663 reinit_parse_for_function ();
667 component_constructor_declarator:
668 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
669 { $$ = make_call_declarator ($1, $3, $5, $6); }
670 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
671 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
672 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
673 { $$ = make_call_declarator ($1, $3, $5, $6); }
674 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
675 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
678 /* more C++ complexity. See component_decl for a comment on the
679 reduce/reduce conflict introduced by these rules. */
681 declmods component_constructor_declarator
682 { tree specs = strip_attrs ($1);
683 $$ = start_method (specs, $2);
687 if (yychar == YYEMPTY)
689 reinit_parse_for_method (yychar, $$); }
690 | component_constructor_declarator
691 { $$ = start_method (NULL_TREE, $1); goto rest_of_mdef; }
692 | typed_declspecs declarator
693 { tree specs = strip_attrs ($1.t);
694 $$ = start_method (specs, $2); goto rest_of_mdef; }
695 | declmods notype_declarator
696 { tree specs = strip_attrs ($1);
697 $$ = start_method (specs, $2); goto rest_of_mdef; }
699 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
700 | declmods constructor_declarator
701 { tree specs = strip_attrs ($1);
702 $$ = start_method (specs, $2); goto rest_of_mdef; }
703 | constructor_declarator
704 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
710 if (! current_function_parms_stored)
718 { store_return_init ($<ttype>$, $2); }
719 | return_id '(' nonnull_exprlist ')'
720 { store_return_init ($<ttype>$, $3); }
721 | return_id LEFT_RIGHT
722 { store_return_init ($<ttype>$, NULL_TREE); }
726 ':' .set_base_init member_init_list
729 error ("no base initializers given following ':'");
731 /* Always keep the BLOCK node associated with the outermost
732 pair of curley braces of a function. These are needed
733 for correct operation of dwarfout.c. */
741 if (! current_function_parms_stored)
744 if (DECL_CONSTRUCTOR_P (current_function_decl))
746 /* Make a contour for the initializer list. */
749 expand_start_bindings (0);
751 else if (current_class_type == NULL_TREE)
752 error ("base initializers not allowed for non-member functions");
753 else if (! DECL_CONSTRUCTOR_P (current_function_decl))
754 error ("only constructors take base initializers");
763 | member_init_list ',' member_init
764 | member_init_list error
768 '(' nonnull_exprlist ')'
770 if (current_class_name)
771 pedwarn ("anachronistic old style base class initializer");
772 expand_member_init (current_class_ref, NULL_TREE, $2);
776 if (current_class_name)
777 pedwarn ("anachronistic old style base class initializer");
778 expand_member_init (current_class_ref, NULL_TREE, void_type_node);
780 | notype_identifier '(' nonnull_exprlist ')'
781 { expand_member_init (current_class_ref, $1, $3); }
782 | notype_identifier LEFT_RIGHT
783 { expand_member_init (current_class_ref, $1, void_type_node); }
784 | complete_type_name '(' nonnull_exprlist ')'
785 { expand_member_init (current_class_ref, $1, $3); }
786 | complete_type_name LEFT_RIGHT
787 { expand_member_init (current_class_ref, $1, void_type_node); }
789 | notype_qualified_id '(' nonnull_exprlist ')'
791 do_member_init (OP0 ($1), OP1 ($1), $3);
793 | notype_qualified_id LEFT_RIGHT
795 do_member_init (OP0 ($1), OP1 ($1), void_type_node);
819 explicit_instantiation:
820 TEMPLATE aggr template_type
821 { do_type_instantiation ($3, NULL_TREE); }
822 | TEMPLATE typed_declspecs declarator
823 { tree specs = strip_attrs ($2.t);
824 do_decl_instantiation (specs, $3, NULL_TREE); }
825 | TEMPLATE notype_declarator
826 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
827 | TEMPLATE constructor_declarator
828 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
829 | SCSPEC TEMPLATE aggr template_type
830 { do_type_instantiation ($4, $1); }
831 | SCSPEC TEMPLATE typed_declspecs declarator
832 { tree specs = strip_attrs ($3.t);
833 do_decl_instantiation (specs, $4, $1); }
834 | SCSPEC TEMPLATE notype_declarator
835 { do_decl_instantiation (NULL_TREE, $3, $1); }
836 | SCSPEC TEMPLATE constructor_declarator
837 { do_decl_instantiation (NULL_TREE, $3, $1); }
840 /* The TYPENAME expansions are to deal with use of a template class name as
841 a template within the class itself, where the template decl is hidden by
842 a type decl. Got all that? */
845 PTYPENAME '<' template_arg_list template_close_bracket
847 $$ = lookup_template_class ($1, $3, NULL_TREE);
848 if ($$ != error_mark_node)
849 $$ = TYPE_STUB_DECL ($$);
851 | PTYPENAME '<' template_close_bracket
853 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
854 if ($$ != error_mark_node)
855 $$ = TYPE_STUB_DECL ($$);
857 | TYPENAME '<' template_arg_list template_close_bracket
859 $$ = lookup_template_class ($1, $3, NULL_TREE);
860 if ($$ != error_mark_node)
861 $$ = TYPE_STUB_DECL ($$);
863 | TYPENAME '<' template_close_bracket
865 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
866 if ($$ != error_mark_node)
867 $$ = TYPE_STUB_DECL ($$);
873 SELFNAME '<' template_arg_list template_close_bracket
875 $$ = lookup_template_class ($1, $3, NULL_TREE);
876 if ($$ != error_mark_node)
877 $$ = TYPE_STUB_DECL ($$);
879 | SELFNAME '<' template_close_bracket
881 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
882 if ($$ != error_mark_node)
883 $$ = TYPE_STUB_DECL ($$);
887 template_close_bracket:
891 /* Handle `Class<Class<Type>>' without space in the `>>' */
892 pedwarn ("`>>' should be `> >' in template class name");
899 { $$ = build_tree_list (NULL_TREE, $$); }
900 | template_arg_list ',' template_arg
901 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
906 { $$ = groktypename ($1.t); }
907 | expr_no_commas %prec ARITHCOMPARE
912 { $$ = NEGATE_EXPR; }
914 { $$ = CONVERT_EXPR; }
916 { $$ = PREINCREMENT_EXPR; }
918 { $$ = PREDECREMENT_EXPR; }
920 { $$ = TRUTH_NOT_EXPR; }
925 { $$ = build_x_compound_expr ($$); }
931 { error ("ANSI C++ forbids an empty condition for `%s'",
933 $$ = integer_zero_node; }
935 { $$ = condition_conversion ($2); }
940 { error ("ANSI C++ forbids an empty condition for `%s'",
942 $$ = integer_zero_node; }
944 { $$ = condition_conversion ($2); }
951 { $$ = condition_conversion ($$); }
957 type_specifier_seq declarator maybeasm maybe_attribute '='
960 for (d = getdecls (); d; d = TREE_CHAIN (d))
961 if (TREE_CODE (d) == TYPE_DECL) {
962 tree s = TREE_TYPE (d);
963 if (TREE_CODE (s) == RECORD_TYPE)
964 cp_error ("definition of class `%T' in condition", s);
965 else if (TREE_CODE (s) == ENUMERAL_TYPE)
966 cp_error ("definition of enum `%T' in condition", s);
969 current_declspecs = $1.t;
970 $<itype>5 = suspend_momentary ();
971 $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1);
972 cplus_decl_attributes ($<ttype>$, $4,
973 /*prefix_attributes*/ NULL_TREE);
977 cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
978 resume_momentary ($<itype>5);
980 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
981 cp_error ("definition of array `%#D' in condition", $$);
988 | maybe_label_decls stmts '}'
989 | maybe_label_decls stmts error '}'
990 | maybe_label_decls error '}'
996 if (processing_template_decl)
998 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
999 COMPOUND_STMT_NO_SCOPE ($<ttype>$) = 1;
1000 add_tree ($<ttype>$);
1005 if (processing_template_decl)
1007 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
1008 TREE_CHAIN ($<ttype>2) = NULL_TREE;
1009 last_tree = $<ttype>2;
1017 nontrivial_exprlist:
1018 expr_no_commas ',' expr_no_commas
1019 { $$ = tree_cons (NULL_TREE, $$,
1020 build_tree_list (NULL_TREE, $3)); }
1021 | expr_no_commas ',' error
1022 { $$ = tree_cons (NULL_TREE, $$,
1023 build_tree_list (NULL_TREE, error_mark_node)); }
1024 | nontrivial_exprlist ',' expr_no_commas
1025 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1026 | nontrivial_exprlist ',' error
1027 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1032 { $$ = build_tree_list (NULL_TREE, $$); }
1033 | nontrivial_exprlist
1039 /* __extension__ turns off -pedantic for following primary. */
1040 | extension cast_expr %prec UNARY
1042 pedantic = $<itype>1; }
1043 | '*' cast_expr %prec UNARY
1044 { $$ = build_x_indirect_ref ($2, "unary *"); }
1045 | '&' cast_expr %prec UNARY
1046 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1048 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1049 | unop cast_expr %prec UNARY
1050 { $$ = build_x_unary_op ($1, $2);
1051 if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
1052 TREE_NEGATED_INT ($$) = 1;
1053 overflow_warning ($$);
1055 /* Refer to the address of a label as a pointer. */
1057 { tree label = lookup_label ($2);
1058 if (label == NULL_TREE)
1059 $$ = null_pointer_node;
1062 TREE_USED (label) = 1;
1063 $$ = build1 (ADDR_EXPR, ptr_type_node, label);
1064 TREE_CONSTANT ($$) = 1;
1067 | SIZEOF unary_expr %prec UNARY
1068 { $$ = expr_sizeof ($2); }
1069 | SIZEOF '(' type_id ')' %prec HYPERUNARY
1070 { $$ = c_sizeof (groktypename ($3.t)); }
1071 | ALIGNOF unary_expr %prec UNARY
1072 { $$ = grok_alignof ($2); }
1073 | ALIGNOF '(' type_id ')' %prec HYPERUNARY
1074 { $$ = c_alignof (groktypename ($3.t));
1075 check_for_new_type ("alignof", $3); }
1077 /* The %prec EMPTY's here are required by the = init initializer
1078 syntax extension; see below. */
1079 | new new_type_id %prec EMPTY
1080 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1081 check_for_new_type ("new", $2); }
1082 | new new_type_id new_initializer
1083 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1084 check_for_new_type ("new", $2); }
1085 | new new_placement new_type_id %prec EMPTY
1086 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1087 check_for_new_type ("new", $3); }
1088 | new new_placement new_type_id new_initializer
1089 { $$ = build_new ($2, $3.t, $4, $1);
1090 check_for_new_type ("new", $3); }
1091 | new '(' type_id ')' %prec EMPTY
1092 { $$ = build_new (NULL_TREE, groktypename($3.t),
1094 check_for_new_type ("new", $3); }
1095 | new '(' type_id ')' new_initializer
1096 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1097 check_for_new_type ("new", $3); }
1098 | new new_placement '(' type_id ')' %prec EMPTY
1099 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1100 check_for_new_type ("new", $4); }
1101 | new new_placement '(' type_id ')' new_initializer
1102 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1103 check_for_new_type ("new", $4); }
1105 | delete cast_expr %prec UNARY
1106 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1107 | delete '[' ']' cast_expr %prec UNARY
1108 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1109 if (yychar == YYEMPTY)
1111 | delete '[' expr ']' cast_expr %prec UNARY
1112 { $$ = delete_sanity ($5, $3, 2, $1);
1113 if (yychar == YYEMPTY)
1115 | REALPART cast_expr %prec UNARY
1116 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1117 | IMAGPART cast_expr %prec UNARY
1118 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1122 '(' nonnull_exprlist ')'
1124 | '{' nonnull_exprlist '}'
1127 pedwarn ("old style placement syntax, use () instead");
1132 '(' nonnull_exprlist ')'
1138 cp_error ("`%T' is not a valid expression", $2.t);
1139 $$ = error_mark_node;
1141 /* GNU extension so people can use initializer lists. Note that
1142 this alters the meaning of `new int = 1', which was previously
1143 syntactically valid but semantically invalid. */
1147 pedwarn ("ANSI C++ forbids initialization of new expression with `='");
1152 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1154 '(' type_id ')' %prec EMPTY
1155 { $2.t = tree_cons (NULL_TREE, $2.t, void_list_node);
1156 TREE_PARMLIST ($2.t) = 1;
1157 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1158 check_for_new_type ("cast", $2); }
1159 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1160 { $3.t = tree_cons (NULL_TREE, $3.t, void_list_node);
1161 TREE_PARMLIST ($3.t) = 1;
1162 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1163 check_for_new_type ("cast", $3); }
1168 | regcast_or_absdcl unary_expr %prec UNARY
1169 { $$ = reparse_absdcl_as_casts ($$, $2); }
1170 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1172 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1175 pedwarn ("ANSI C++ forbids constructor-expressions");
1176 /* Indicate that this was a GNU C constructor expression. */
1177 TREE_HAS_CONSTRUCTOR (init) = 1;
1179 $$ = reparse_absdcl_as_casts ($$, init);
1185 /* Handle general members. */
1186 | expr_no_commas POINTSAT_STAR expr_no_commas
1187 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1188 | expr_no_commas DOT_STAR expr_no_commas
1189 { $$ = build_m_component_ref ($$, $3); }
1190 | expr_no_commas '+' expr_no_commas
1191 { $$ = build_x_binary_op ($2, $$, $3); }
1192 | expr_no_commas '-' expr_no_commas
1193 { $$ = build_x_binary_op ($2, $$, $3); }
1194 | expr_no_commas '*' expr_no_commas
1195 { $$ = build_x_binary_op ($2, $$, $3); }
1196 | expr_no_commas '/' expr_no_commas
1197 { $$ = build_x_binary_op ($2, $$, $3); }
1198 | expr_no_commas '%' expr_no_commas
1199 { $$ = build_x_binary_op ($2, $$, $3); }
1200 | expr_no_commas LSHIFT expr_no_commas
1201 { $$ = build_x_binary_op ($2, $$, $3); }
1202 | expr_no_commas RSHIFT expr_no_commas
1203 { $$ = build_x_binary_op ($2, $$, $3); }
1204 | expr_no_commas ARITHCOMPARE expr_no_commas
1205 { $$ = build_x_binary_op ($2, $$, $3); }
1206 | expr_no_commas '<' expr_no_commas
1207 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1208 | expr_no_commas '>' expr_no_commas
1209 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1210 | expr_no_commas EQCOMPARE expr_no_commas
1211 { $$ = build_x_binary_op ($2, $$, $3); }
1212 | expr_no_commas MIN_MAX expr_no_commas
1213 { $$ = build_x_binary_op ($2, $$, $3); }
1214 | expr_no_commas '&' expr_no_commas
1215 { $$ = build_x_binary_op ($2, $$, $3); }
1216 | expr_no_commas '|' expr_no_commas
1217 { $$ = build_x_binary_op ($2, $$, $3); }
1218 | expr_no_commas '^' expr_no_commas
1219 { $$ = build_x_binary_op ($2, $$, $3); }
1220 | expr_no_commas ANDAND expr_no_commas
1221 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1222 | expr_no_commas OROR expr_no_commas
1223 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1224 | expr_no_commas '?' xexpr ':' expr_no_commas
1225 { $$ = build_x_conditional_expr ($$, $3, $5); }
1226 | expr_no_commas '=' expr_no_commas
1227 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1228 if ($$ != error_mark_node)
1229 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1230 | expr_no_commas ASSIGN expr_no_commas
1231 { $$ = build_x_modify_expr ($$, $2, $3); }
1233 { $$ = build_throw (NULL_TREE); }
1234 | THROW expr_no_commas
1235 { $$ = build_throw ($2); }
1236 /* These extensions are not defined. The second arg to build_m_component_ref
1237 is old, build_m_component_ref now does an implicit
1238 build_indirect_ref (x, NULL_PTR) on the second argument.
1239 | object '&' expr_no_commas %prec UNARY
1240 { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
1241 | object unop expr_no_commas %prec UNARY
1242 { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
1243 | object '(' type_id ')' expr_no_commas %prec UNARY
1244 { tree type = groktypename ($3.t);
1245 $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
1246 | object primary_no_id %prec UNARY
1247 { $$ = build_m_component_ref ($$, $2); }
1251 notype_unqualified_id:
1252 '~' see_typename identifier
1253 { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
1257 | NSNAME %prec EMPTY
1261 notype_unqualified_id
1267 notype_unqualified_id
1268 | '*' expr_or_declarator %prec UNARY
1269 { $$ = build_parse_node (INDIRECT_REF, $2); }
1270 | '&' expr_or_declarator %prec UNARY
1271 { $$ = build_parse_node (ADDR_EXPR, $2); }
1272 | '(' expr_or_declarator ')'
1276 direct_notype_declarator:
1277 complex_direct_notype_declarator
1278 | notype_unqualified_id
1279 | '(' expr_or_declarator ')'
1280 { $$ = finish_decl_parsing ($2); }
1284 notype_unqualified_id
1286 if (TREE_CODE ($$) == BIT_NOT_EXPR)
1287 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
1289 $$ = do_identifier ($$, 1);
1295 if (processing_template_decl)
1296 push_obstacks (&permanent_obstack, &permanent_obstack);
1297 $$ = combine_strings ($$);
1298 if (processing_template_decl)
1304 class = TREE_CODE_CLASS (TREE_CODE ($$));
1305 if (class == 'e' || class == '1'
1306 || class == '2' || class == '<')
1307 /* This inhibits warnings in truthvalue_conversion. */
1308 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1309 | '(' expr_or_declarator ')'
1311 $$ = reparse_decl_as_expr (NULL_TREE, $2);
1312 class = TREE_CODE_CLASS (TREE_CODE ($$));
1313 if (class == 'e' || class == '1'
1314 || class == '2' || class == '<')
1315 /* This inhibits warnings in truthvalue_conversion. */
1316 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1318 { $$ = error_mark_node; }
1320 { if (current_function_decl == 0)
1322 error ("braced-group within expression allowed only inside a function");
1326 $<ttype>$ = expand_start_stmt_expr (); }
1330 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1331 rtl_exp = expand_end_stmt_expr ($<ttype>2);
1332 /* The statements have side effects, so the group does. */
1333 TREE_SIDE_EFFECTS (rtl_exp) = 1;
1335 if (TREE_CODE ($3) == BLOCK)
1337 /* Make a BIND_EXPR for the BLOCK already made. */
1338 $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
1339 NULL_TREE, rtl_exp, $3);
1340 /* Remove the block from the tree at this point.
1341 It gets put back at the proper place
1342 when the BIND_EXPR is expanded. */
1348 | primary '(' nonnull_exprlist ')'
1350 $$ = build_x_function_call ($1, $3, current_class_ref);
1351 if (TREE_CODE ($$) == CALL_EXPR
1352 && TREE_TYPE ($$) != void_type_node)
1353 $$ = require_complete_type ($$);
1355 | primary LEFT_RIGHT
1357 $$ = build_x_function_call ($$, NULL_TREE, current_class_ref);
1358 if (TREE_CODE ($$) == CALL_EXPR
1359 && TREE_TYPE ($$) != void_type_node)
1360 $$ = require_complete_type ($$);
1362 | primary '[' expr ']'
1363 { $$ = grok_array_decl ($$, $3); }
1365 { /* If we get an OFFSET_REF, turn it into what it really
1366 means (e.g., a COMPONENT_REF). This way if we've got,
1367 say, a reference to a static member that's being operated
1368 on, we don't end up trying to find a member operator for
1369 the class it's in. */
1370 if (TREE_CODE ($$) == OFFSET_REF)
1371 $$ = resolve_offset_ref ($$);
1372 $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1373 | primary MINUSMINUS
1374 { if (TREE_CODE ($$) == OFFSET_REF)
1375 $$ = resolve_offset_ref ($$);
1376 $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1377 /* C++ extensions */
1379 { if (current_class_ptr)
1381 #ifdef WARNING_ABOUT_CCD
1382 TREE_USED (current_class_ptr) = 1;
1384 $$ = current_class_ptr;
1386 else if (current_function_decl
1387 && DECL_STATIC_FUNCTION_P (current_function_decl))
1389 error ("`this' is unavailable for static member functions");
1390 $$ = error_mark_node;
1394 if (current_function_decl)
1395 error ("invalid use of `this' in non-member function");
1397 error ("invalid use of `this' at top level");
1398 $$ = error_mark_node;
1401 | CV_QUALIFIER '(' nonnull_exprlist ')'
1406 /* This is a C cast in C++'s `functional' notation. */
1407 if ($3 == error_mark_node)
1409 $$ = error_mark_node;
1413 if ($3 == NULL_TREE)
1415 error ("cannot cast null list to type `%s'",
1416 IDENTIFIER_POINTER (TYPE_NAME (id)));
1417 $$ = error_mark_node;
1422 /* type is not set! (mrs) */
1423 if (type == error_mark_node)
1424 $$ = error_mark_node;
1428 if (id == ridpointers[(int) RID_CONST])
1429 type = build_type_variant (integer_type_node, 1, 0);
1430 else if (id == ridpointers[(int) RID_VOLATILE])
1431 type = build_type_variant (integer_type_node, 0, 1);
1433 /* should not be able to get here (mrs) */
1434 else if (id == ridpointers[(int) RID_FRIEND])
1436 error ("cannot cast expression to `friend' type");
1437 $$ = error_mark_node;
1441 else my_friendly_abort (79);
1442 $$ = build_c_cast (type, build_compound_expr ($3));
1446 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1447 { tree type = groktypename ($3.t);
1448 check_for_new_type ("dynamic_cast", $3);
1449 $$ = build_dynamic_cast (type, $6); }
1450 | STATIC_CAST '<' type_id '>' '(' expr ')'
1451 { tree type = groktypename ($3.t);
1452 check_for_new_type ("static_cast", $3);
1453 $$ = build_static_cast (type, $6); }
1454 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1455 { tree type = groktypename ($3.t);
1456 check_for_new_type ("reinterpret_cast", $3);
1457 $$ = build_reinterpret_cast (type, $6); }
1458 | CONST_CAST '<' type_id '>' '(' expr ')'
1459 { tree type = groktypename ($3.t);
1460 check_for_new_type ("const_cast", $3);
1461 $$ = build_const_cast (type, $6); }
1462 | TYPEID '(' expr ')'
1463 { $$ = build_x_typeid ($3); }
1464 | TYPEID '(' type_id ')'
1465 { tree type = groktypename ($3.t);
1466 check_for_new_type ("typeid", $3);
1467 $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
1468 | global_scope IDENTIFIER
1469 { $$ = do_scoped_id ($2, 1); }
1470 | global_scope operator_name
1472 got_scope = NULL_TREE;
1473 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1474 $$ = do_scoped_id ($2, 1);
1478 | overqualified_id %prec HYPERUNARY
1479 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1480 | overqualified_id '(' nonnull_exprlist ')'
1481 { if (processing_template_decl)
1482 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, NULL_TREE);
1484 $$ = build_member_call (OP0 ($$), OP1 ($$), $3); }
1485 | overqualified_id LEFT_RIGHT
1486 { if (processing_template_decl)
1487 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1),
1488 NULL_TREE, NULL_TREE);
1490 $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); }
1491 | object unqualified_id %prec UNARY
1492 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1493 | object overqualified_id %prec UNARY
1494 { if (processing_template_decl)
1495 $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
1497 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1498 | object unqualified_id '(' nonnull_exprlist ')'
1501 /* This is a future direction of this code, but because
1502 build_x_function_call cannot always undo what is done
1503 in build_component_ref entirely yet, we cannot do this. */
1504 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, current_class_ref);
1505 if (TREE_CODE ($$) == CALL_EXPR
1506 && TREE_TYPE ($$) != void_type_node)
1507 $$ = require_complete_type ($$);
1509 $$ = build_method_call ($$, $2, $4, NULL_TREE,
1513 | object unqualified_id LEFT_RIGHT
1516 /* This is a future direction of this code, but because
1517 build_x_function_call cannot always undo what is done
1518 in build_component_ref entirely yet, we cannot do this. */
1519 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, current_class_ref);
1520 if (TREE_CODE ($$) == CALL_EXPR
1521 && TREE_TYPE ($$) != void_type_node)
1522 $$ = require_complete_type ($$);
1524 $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
1528 | object overqualified_id '(' nonnull_exprlist ')'
1530 if (IS_SIGNATURE (OP0 ($2)))
1532 warning ("signature name in scope resolution ignored");
1533 $$ = build_method_call ($$, OP1 ($2), $4, NULL_TREE,
1537 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
1539 | object overqualified_id LEFT_RIGHT
1541 if (IS_SIGNATURE (OP0 ($2)))
1543 warning ("signature name in scope resolution ignored");
1544 $$ = build_method_call ($$, OP1 ($2), NULL_TREE, NULL_TREE,
1548 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), NULL_TREE);
1550 /* p->int::~int() is valid -- 12.4 */
1551 | object '~' TYPESPEC LEFT_RIGHT
1553 if (IDENTIFIER_GLOBAL_VALUE ($3)
1554 && (TREE_CODE (TREE_TYPE ($1))
1555 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
1556 cp_error ("`%E' is not of type `%T'", $1, $3);
1557 $$ = cp_convert (void_type_node, $1);
1559 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1562 cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
1563 if (TREE_CODE (TREE_TYPE ($1))
1564 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
1565 cp_error ("`%E' is not of type `%T'", $1, $2);
1566 $$ = cp_convert (void_type_node, $1);
1570 $$ = error_mark_node;
1574 /* Not needed for now.
1580 { $$ = error_mark_node; }
1582 { if (current_function_decl == 0)
1584 error ("braced-group within expression allowed only inside a function");
1587 $<ttype>$ = expand_start_stmt_expr (); }
1590 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1591 $$ = expand_end_stmt_expr ($<ttype>2); }
1592 | primary_no_id '(' nonnull_exprlist ')'
1593 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1594 | primary_no_id LEFT_RIGHT
1595 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1596 | primary_no_id '[' expr ']'
1598 | primary_no_id PLUSPLUS
1599 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1600 | primary_no_id MINUSMINUS
1601 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1603 { goto do_scoped_id; }
1604 | SCOPE operator_name
1605 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1607 goto do_scoped_operator;
1616 { got_scope = NULL_TREE; $$ = 1; }
1622 | global_scope delete
1623 { got_scope = NULL_TREE; $$ = 1; }
1628 { $$ = boolean_true_node; }
1630 { $$ = boolean_false_node; }
1633 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1637 { $$ = chainon ($$, $2); }
1643 if (! current_function_parms_stored)
1644 store_parm_decls ();
1646 /* Always keep the BLOCK node associated with the outermost
1647 pair of curley braces of a function. These are needed
1648 for correct operation of dwarfout.c. */
1655 { got_object = TREE_TYPE ($$); }
1658 $$ = build_x_arrow ($$);
1659 got_object = TREE_TYPE ($$);
1664 typespec initdecls ';'
1666 resume_momentary ($2);
1667 if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1668 note_got_semicolon ($1.t);
1670 | typed_declspecs initdecls ';'
1672 resume_momentary ($2);
1673 note_list_got_semicolon ($1.t);
1675 | declmods notype_initdecls ';'
1676 { resume_momentary ($2); }
1677 | typed_declspecs ';'
1680 note_list_got_semicolon ($1.t);
1683 { warning ("empty declaration"); }
1685 { pedantic = $<itype>1; }
1688 /* Any kind of declarator (thus, all declarators allowed
1689 after an explicit typespec). */
1692 after_type_declarator %prec EMPTY
1693 | notype_declarator %prec EMPTY
1696 /* This is necessary to postpone reduction of `int()()()()'. */
1698 LEFT_RIGHT %prec EMPTY
1699 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1700 NULL_TREE, NULL_TREE); }
1701 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1702 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1706 /* ANSI type-id (8.1) */
1708 typed_typespecs absdcl
1709 { $$.t = build_decl_list ($1.t, $2);
1710 $$.new_type_flag = $1.new_type_flag; }
1711 | nonempty_cv_qualifiers absdcl
1712 { $$.t = build_decl_list ($1.t, $2);
1713 $$.new_type_flag = $1.new_type_flag; }
1715 { $$.t = build_decl_list (get_decl_list ($1.t), $2);
1716 $$.new_type_flag = $1.new_type_flag; }
1717 | typed_typespecs %prec EMPTY
1718 { $$.t = build_decl_list ($1.t, NULL_TREE);
1719 $$.new_type_flag = $1.new_type_flag; }
1720 | nonempty_cv_qualifiers %prec EMPTY
1721 { $$.t = build_decl_list ($1.t, NULL_TREE);
1722 $$.new_type_flag = $1.new_type_flag; }
1725 /* Declspecs which contain at least one type specifier or typedef name.
1726 (Just `const' or `volatile' is not enough.)
1727 A typedef'd name following these is taken as a name to be declared.
1728 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1731 typed_typespecs %prec EMPTY
1737 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1);
1738 $$.new_type_flag = $2.new_type_flag; }
1739 | typespec reserved_declspecs %prec HYPERUNARY
1740 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1741 $$.new_type_flag = $1.new_type_flag; }
1742 | typespec reserved_typespecquals reserved_declspecs
1743 { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1744 $$.new_type_flag = $1.new_type_flag; }
1745 | declmods typespec reserved_declspecs
1746 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1747 $$.new_type_flag = $2.new_type_flag; }
1748 | declmods typespec reserved_typespecquals
1749 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1750 $$.new_type_flag = $2.new_type_flag; }
1751 | declmods typespec reserved_typespecquals reserved_declspecs
1752 { $$.t = decl_tree_cons (NULL_TREE, $2.t,
1753 chainon ($3, chainon ($4, $1)));
1754 $$.new_type_flag = $2.new_type_flag; }
1759 { if (extra_warnings)
1760 warning ("`%s' is not at beginning of declaration",
1761 IDENTIFIER_POINTER ($$));
1762 $$ = build_decl_list (NULL_TREE, $$); }
1763 | reserved_declspecs typespecqual_reserved
1764 { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
1765 | reserved_declspecs SCSPEC
1766 { if (extra_warnings)
1767 warning ("`%s' is not at beginning of declaration",
1768 IDENTIFIER_POINTER ($2));
1769 $$ = decl_tree_cons (NULL_TREE, $2, $$); }
1770 | reserved_declspecs attributes
1771 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1773 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1776 /* List of just storage classes and type modifiers.
1777 A declaration can start with just this, but then it cannot be used
1778 to redeclare a typedef-name.
1779 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1782 nonempty_cv_qualifiers %prec EMPTY
1783 { $$ = $1.t; TREE_STATIC ($$) = 1; }
1785 { $$ = IDENTIFIER_AS_LIST ($$); }
1786 | declmods CV_QUALIFIER
1787 { $$ = decl_tree_cons (NULL_TREE, $2, $$);
1788 TREE_STATIC ($$) = 1; }
1790 { if (extra_warnings && TREE_STATIC ($$))
1791 warning ("`%s' is not at beginning of declaration",
1792 IDENTIFIER_POINTER ($2));
1793 $$ = decl_tree_cons (NULL_TREE, $2, $$);
1794 TREE_STATIC ($$) = TREE_STATIC ($1); }
1795 | declmods attributes
1796 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1798 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1801 /* Used instead of declspecs where storage classes are not allowed
1802 (that is, for typenames and structure components).
1804 C++ can takes storage classes for structure components.
1805 Don't accept a typedef-name if anything but a modifier precedes it. */
1808 typespec %prec EMPTY
1809 { $$.t = get_decl_list ($1.t);
1810 $$.new_type_flag = $1.new_type_flag; }
1811 | nonempty_cv_qualifiers typespec
1812 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
1813 $$.new_type_flag = $2.new_type_flag; }
1814 | typespec reserved_typespecquals
1815 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1816 $$.new_type_flag = $1.new_type_flag; }
1817 | nonempty_cv_qualifiers typespec reserved_typespecquals
1818 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1819 $$.new_type_flag = $1.new_type_flag; }
1822 reserved_typespecquals:
1823 typespecqual_reserved
1824 { $$ = build_decl_list (NULL_TREE, $1.t); }
1825 | reserved_typespecquals typespecqual_reserved
1826 { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
1829 /* A typespec (but not a type qualifier).
1830 Once we have seen one of these in a declaration,
1831 if a typedef name appears then it is being redeclared. */
1835 | TYPESPEC %prec EMPTY
1836 { $$.t = $1; $$.new_type_flag = 0; }
1837 | complete_type_name
1838 { $$.t = $1; $$.new_type_flag = 0; }
1839 | TYPEOF '(' expr ')'
1840 { $$.t = TREE_TYPE ($3);
1841 $$.new_type_flag = 0; }
1842 | TYPEOF '(' type_id ')'
1843 { $$.t = groktypename ($3.t);
1844 $$.new_type_flag = 0; }
1845 | SIGOF '(' expr ')'
1846 { tree type = TREE_TYPE ($3);
1848 $$.new_type_flag = 0;
1849 if (IS_AGGR_TYPE (type))
1851 sorry ("sigof type specifier");
1856 error ("`sigof' applied to non-aggregate expression");
1857 $$.t = error_mark_node;
1860 | SIGOF '(' type_id ')'
1861 { tree type = groktypename ($3.t);
1863 $$.new_type_flag = 0;
1864 if (IS_AGGR_TYPE (type))
1866 sorry ("sigof type specifier");
1871 error("`sigof' applied to non-aggregate type");
1872 $$.t = error_mark_node;
1877 /* A typespec that is a reserved word, or a type qualifier. */
1879 typespecqual_reserved:
1881 { $$.t = $1; $$.new_type_flag = 0; }
1883 { $$.t = $1; $$.new_type_flag = 0; }
1889 | initdecls ',' initdcl
1894 | notype_initdecls ',' initdcl
1899 | nomods_initdecls ',' initdcl
1905 | asm_keyword '(' string ')'
1906 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
1910 declarator maybeasm maybe_attribute '='
1911 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1912 &prefix_attributes);
1913 if (current_declspecs
1914 && TREE_CODE (current_declspecs) != TREE_LIST)
1915 current_declspecs = get_decl_list (current_declspecs);
1916 if (have_extern_spec && !used_extern_spec)
1918 current_declspecs = decl_tree_cons
1919 (NULL_TREE, get_identifier ("extern"),
1921 used_extern_spec = 1;
1923 $<itype>4 = suspend_momentary ();
1924 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1925 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1927 /* Note how the declaration of the variable is in effect while its init is parsed! */
1928 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1930 | declarator maybeasm maybe_attribute
1932 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1933 &prefix_attributes);
1934 if (current_declspecs
1935 && TREE_CODE (current_declspecs) != TREE_LIST)
1936 current_declspecs = get_decl_list (current_declspecs);
1937 if (have_extern_spec && !used_extern_spec)
1939 current_declspecs = decl_tree_cons
1940 (NULL_TREE, get_identifier ("extern"),
1942 used_extern_spec = 1;
1944 $$ = suspend_momentary ();
1945 d = start_decl ($<ttype>1, current_declspecs, 0);
1946 cplus_decl_attributes (d, $3, prefix_attributes);
1947 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1951 declarator maybeasm maybe_attribute '='
1952 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1953 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1955 /* Note how the declaration of the variable is in effect while its init is parsed! */
1956 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING); }
1957 | declarator maybeasm maybe_attribute
1958 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0);
1959 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes);
1960 cp_finish_decl ($<ttype>$, NULL_TREE, $2, 1, 0); }
1964 notype_declarator maybeasm maybe_attribute '='
1965 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1966 &prefix_attributes);
1967 $<itype>4 = suspend_momentary ();
1968 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1969 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1971 /* Note how the declaration of the variable is in effect while its init is parsed! */
1972 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1974 | notype_declarator maybeasm maybe_attribute
1976 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1977 &prefix_attributes);
1978 $$ = suspend_momentary ();
1979 d = start_decl ($<ttype>1, current_declspecs, 0);
1980 cplus_decl_attributes (d, $3, prefix_attributes);
1981 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1985 notype_declarator maybeasm maybe_attribute '='
1986 { current_declspecs = NULL_TREE;
1987 prefix_attributes = NULL_TREE;
1988 $<itype>4 = suspend_momentary ();
1989 $<ttype>$ = start_decl ($1, current_declspecs, 1);
1990 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1992 /* Note how the declaration of the variable is in effect while its init is parsed! */
1993 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1995 | notype_declarator maybeasm maybe_attribute
1997 current_declspecs = NULL_TREE;
1998 prefix_attributes = NULL_TREE;
1999 $$ = suspend_momentary ();
2000 d = start_decl ($1, current_declspecs, 0);
2001 cplus_decl_attributes (d, $3, prefix_attributes);
2002 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
2005 /* the * rules are dummies to accept the Apollo extended syntax
2006 so that the header files compile. */
2017 | attributes attribute
2018 { $$ = chainon ($1, $2); }
2022 ATTRIBUTE '(' '(' attribute_list ')' ')'
2029 | attribute_list ',' attrib
2030 { $$ = chainon ($1, $3); }
2037 { $$ = build_tree_list ($1, NULL_TREE); }
2038 | any_word '(' IDENTIFIER ')'
2039 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2040 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2041 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2042 | any_word '(' nonnull_exprlist ')'
2043 { $$ = build_tree_list ($1, $3); }
2046 /* This still leaves out most reserved keywords,
2047 shouldn't we include them? */
2056 /* A nonempty list of identifiers, including typenames. */
2057 identifiers_or_typenames:
2059 { $$ = build_tree_list (NULL_TREE, $1); }
2060 | identifiers_or_typenames ',' identifier
2061 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2065 /* empty */ %prec EMPTY
2070 /* If we are processing a template, we don't want to expand this
2074 expr_no_commas %prec '='
2076 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2077 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2079 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2080 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2081 | '{' initlist ',' '}'
2082 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2083 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2088 /* This chain is built in reverse order,
2089 and put in forward order where initlist is used. */
2092 { $$ = build_tree_list (NULL_TREE, $$); }
2094 { $$ = tree_cons (NULL_TREE, $3, $$); }
2095 /* These are for labeled elements. */
2096 | '[' expr_no_commas ']' init
2097 { $$ = build_tree_list ($2, $4); }
2098 | initlist ',' CASE expr_no_commas ':' init
2099 { $$ = tree_cons ($4, $6, $$); }
2100 | identifier ':' init
2101 { $$ = build_tree_list ($$, $3); }
2102 | initlist ',' identifier ':' init
2103 { $$ = tree_cons ($3, $5, $$); }
2107 PRE_PARSED_FUNCTION_DECL
2108 { start_function (NULL_TREE, TREE_VALUE ($1),
2110 reinit_parse_for_function (); }
2114 | pending_inlines fn.defpen maybe_return_init ctor_initializer_opt
2117 int nested = (hack_decl_function_context
2118 (current_function_decl) != NULL_TREE);
2119 finish_function (lineno, (int)$4, nested);
2120 process_next_inline ($2);
2122 | pending_inlines fn.defpen maybe_return_init function_try_block
2123 { process_next_inline ($2); }
2127 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2128 the TREE_LIST node for the parameter in question. */
2130 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2131 { replace_defarg ($1, $2); }
2134 /* empty */ %prec EMPTY
2135 | pending_defargs defarg_again
2136 { do_pending_defargs (); }
2137 | pending_defargs error
2138 { do_pending_defargs (); }
2143 { $<itype>3 = suspend_momentary ();
2144 $<ttype>$ = start_enum ($2); }
2145 enumlist maybecomma_warn '}'
2146 { $$.t = finish_enum ($<ttype>4, $5);
2147 $$.new_type_flag = 1;
2148 resume_momentary ((int) $<itype>3);
2149 check_for_missing_semicolon ($<ttype>4); }
2150 | ENUM identifier '{' '}'
2151 { $$.t = finish_enum (start_enum ($2), NULL_TREE);
2152 $$.new_type_flag = 1;
2153 check_for_missing_semicolon ($$.t); }
2155 { $<itype>2 = suspend_momentary ();
2156 $<ttype>$ = start_enum (make_anon_name ()); }
2157 enumlist maybecomma_warn '}'
2158 { $$.t = finish_enum ($<ttype>3, $4);
2159 resume_momentary ((int) $<itype>1);
2160 check_for_missing_semicolon ($<ttype>3);
2161 $$.new_type_flag = 1; }
2163 { $$.t = finish_enum (start_enum (make_anon_name()), NULL_TREE);
2164 $$.new_type_flag = 1;
2165 check_for_missing_semicolon ($$.t); }
2167 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2168 $$.new_type_flag = 0; }
2169 | ENUM complex_type_name
2170 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2171 $$.new_type_flag = 0; }
2172 | TYPENAME_KEYWORD nested_name_specifier identifier
2173 { $$.t = make_typename_type ($2, $3);
2174 $$.new_type_flag = 0; }
2175 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2176 { $$.t = make_typename_type ($3, $4);
2177 $$.new_type_flag = 0; }
2178 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2179 | class_head left_curly opt.component_decl_list '}' maybe_attribute
2186 /* Need to rework class nesting in the
2187 presence of nested classes, etc. */
2188 shadow_tag (CLASSTYPE_AS_LIST ($1)); */
2190 if (yychar == YYEMPTY)
2192 semi = yychar == ';';
2193 /* finish_struct nukes this anyway; if
2194 finish_exception does too, then it can go. */
2196 note_got_semicolon ($1);
2198 if (TREE_CODE ($1) == ENUMERAL_TYPE)
2202 $<ttype>$ = finish_struct ($1, $3, $5, semi);
2203 if (semi) note_got_semicolon ($<ttype>$);
2209 check_for_missing_semicolon ($1);
2210 if (current_scope () == current_function_decl)
2211 do_pending_defargs ($1);
2216 && current_scope () == current_function_decl)
2217 do_pending_inlines ();
2222 $$.new_type_flag = 1;
2223 if (current_scope () == current_function_decl)
2224 clear_inline_text_obstack ();
2226 | class_head %prec EMPTY
2229 $$.new_type_flag = 0;
2230 /* struct B: public A; is not accepted by the WP grammar. */
2231 if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
2232 && ! TYPE_BEING_DEFINED ($$.t))
2233 cp_error ("base clause without member specification for `%#T'",
2246 { if (pedantic && !in_system_header)
2247 pedwarn ("comma at end of enumerator list"); }
2253 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2255 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2257 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2259 { error ("no body nor ';' separates two class, struct or union declarations"); }
2262 named_class_head_sans_basetype:
2264 { current_aggr = $$; $$ = $2; }
2267 named_class_head_sans_basetype_defn:
2268 aggr identifier_defn %prec EMPTY
2269 { current_aggr = $$; $$ = $2; }
2272 named_complex_class_head_sans_basetype:
2273 aggr nested_name_specifier identifier
2276 if (TREE_CODE ($3) == TYPE_DECL)
2280 cp_error ("`%T' does not have a nested type named `%D'",
2283 (current_aggr, make_anon_name (), NULL_TREE, 1);
2284 $$ = TYPE_MAIN_DECL ($$);
2287 | aggr template_type
2288 { current_aggr = $$; $$ = $2; }
2289 | aggr nested_name_specifier template_type
2290 { current_aggr = $$; $$ = $3; }
2294 /* empty */ %prec EMPTY
2295 { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
2299 named_class_head_sans_basetype %prec EMPTY
2300 { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
2301 | named_class_head_sans_basetype_defn do_xref_defn
2302 maybe_base_class_list %prec EMPTY
2306 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2308 | named_complex_class_head_sans_basetype maybe_base_class_list
2310 $$ = TREE_TYPE ($1);
2311 if (TREE_INT_CST_LOW (current_aggr) == union_type
2312 && TREE_CODE ($$) != UNION_TYPE)
2313 cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
2314 else if (TREE_CODE ($$) == UNION_TYPE
2315 && TREE_INT_CST_LOW (current_aggr) != union_type)
2316 cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
2319 if (IS_AGGR_TYPE ($$) && CLASSTYPE_USE_TEMPLATE ($$))
2321 if (CLASSTYPE_IMPLICIT_INSTANTIATION ($$)
2322 && TYPE_SIZE ($$) == NULL_TREE)
2324 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION ($$);
2325 if (processing_template_decl)
2326 push_template_decl (TYPE_MAIN_DECL ($$));
2328 else if (CLASSTYPE_TEMPLATE_INSTANTIATION ($$))
2329 cp_error ("specialization after instantiation of `%T'", $$);
2331 xref_basetypes (current_aggr, $1, $$, $2);
2338 { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
2339 yyungetc ('{', 1); }
2347 maybe_base_class_list:
2348 /* empty */ %prec EMPTY
2350 | ':' see_typename %prec EMPTY
2351 { yyungetc(':', 1); $$ = NULL_TREE; }
2352 | ':' see_typename base_class_list %prec EMPTY
2358 | base_class_list ',' see_typename base_class
2359 { $$ = chainon ($$, $4); }
2365 tree type = TREE_TYPE ($1);
2366 if (! is_aggr_type (type, 1))
2368 else if (current_aggr == signature_type_node
2369 && (! type) && (! IS_SIGNATURE (type)))
2371 error ("class name not allowed as base signature");
2374 else if (current_aggr == signature_type_node)
2376 sorry ("signature inheritance, base type `%s' ignored",
2377 IDENTIFIER_POINTER ($$));
2378 $$ = build_tree_list (access_public_node, type);
2380 else if (type && IS_SIGNATURE (type))
2382 error ("signature name not allowed as base class");
2386 $$ = build_tree_list (access_default_node, type);
2388 | base_class_access_list see_typename base_class.1
2390 tree type = TREE_TYPE ($3);
2391 if (current_aggr == signature_type_node)
2392 error ("access and source specifiers not allowed in signature");
2393 if (! IS_AGGR_TYPE (type))
2395 else if (current_aggr == signature_type_node
2396 && (! type) && (! IS_SIGNATURE (type)))
2398 error ("class name not allowed as base signature");
2401 else if (current_aggr == signature_type_node)
2403 sorry ("signature inheritance, base type `%s' ignored",
2404 IDENTIFIER_POINTER ($$));
2405 $$ = build_tree_list (access_public_node, type);
2407 else if (type && IS_SIGNATURE (type))
2409 error ("signature name not allowed as base class");
2413 $$ = build_tree_list ($$, type);
2419 | TYPENAME_KEYWORD nested_name_specifier identifier
2420 { $$ = TYPE_MAIN_DECL (make_typename_type ($2, $3)); }
2421 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2422 { $$ = TYPE_MAIN_DECL (make_typename_type ($3, $4)); }
2423 | SIGOF '(' expr ')'
2425 if (current_aggr == signature_type_node)
2427 if (IS_AGGR_TYPE (TREE_TYPE ($3)))
2429 sorry ("`sigof' as base signature specifier");
2430 $$ = TREE_TYPE ($3);
2434 error ("`sigof' applied to non-aggregate expression");
2435 $$ = error_mark_node;
2440 error ("`sigof' in struct or class declaration");
2441 $$ = error_mark_node;
2444 | SIGOF '(' type_id ')'
2446 if (current_aggr == signature_type_node)
2448 if (IS_AGGR_TYPE (groktypename ($3.t)))
2450 sorry ("`sigof' as base signature specifier");
2451 $$ = groktypename ($3.t);
2455 error ("`sigof' applied to non-aggregate expression");
2456 $$ = error_mark_node;
2461 error ("`sigof' in struct or class declaration");
2462 $$ = error_mark_node;
2467 base_class_access_list:
2468 VISSPEC see_typename
2469 | SCSPEC see_typename
2470 { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
2471 sorry ("non-virtual access");
2472 $$ = access_default_virtual_node; }
2473 | base_class_access_list VISSPEC see_typename
2475 if ($2 == access_protected_node)
2477 warning ("`protected' access not implemented");
2478 $2 = access_public_node;
2481 else if ($2 == access_public_node)
2483 if ($1 == access_private_node)
2486 error ("base class cannot be public and private");
2488 else if ($1 == access_default_virtual_node)
2489 $$ = access_public_virtual_node;
2491 else /* $2 == access_private_node */
2493 if ($1 == access_public_node)
2495 else if ($1 == access_default_virtual_node)
2496 $$ = access_private_virtual_node;
2499 | base_class_access_list SCSPEC see_typename
2500 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2501 sorry ("non-virtual access");
2502 if ($$ == access_public_node)
2503 $$ = access_public_virtual_node;
2504 else if ($$ == access_private_node)
2505 $$ = access_private_virtual_node; }
2510 { tree t = $<ttype>0;
2511 push_obstacks_nochange ();
2512 end_temporary_allocation ();
2514 if (t == error_mark_node
2515 || ! IS_AGGR_TYPE (t))
2517 t = $<ttype>0 = make_lang_type (RECORD_TYPE);
2518 pushtag (make_anon_name (), t, 0);
2521 duplicate_tag_error (t);
2522 if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
2524 t = make_lang_type (TREE_CODE (t));
2525 pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
2528 if (processing_template_decl && TYPE_CONTEXT (t)
2529 && ! current_class_type)
2530 push_template_decl (TYPE_STUB_DECL (t));
2532 TYPE_BEING_DEFINED (t) = 1;
2533 if (IS_AGGR_TYPE (t) && CLASSTYPE_USE_TEMPLATE (t))
2535 if (CLASSTYPE_IMPLICIT_INSTANTIATION (t)
2536 && TYPE_SIZE (t) == NULL_TREE)
2538 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
2539 if (processing_template_decl)
2540 push_template_decl (TYPE_MAIN_DECL (t));
2542 else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
2543 cp_error ("specialization after instantiation of `%T'", t);
2545 /* Reset the interface data, at the earliest possible
2546 moment, as it might have been set via a class foo;
2548 /* Don't change signatures. */
2549 if (! IS_SIGNATURE (t))
2551 extern tree pending_vtables;
2553 tree name = TYPE_IDENTIFIER (t);
2555 if (! ANON_AGGRNAME_P (name))
2557 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
2558 SET_CLASSTYPE_INTERFACE_UNKNOWN_X
2559 (t, interface_unknown);
2562 /* Record how to set the access of this class's
2563 virtual functions. If write_virtuals == 2 or 3, then
2564 inline virtuals are ``extern inline''. */
2565 switch (write_virtuals)
2572 needs_writing = !! value_member (name, pending_vtables);
2575 needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
2576 && CLASSTYPE_INTERFACE_KNOWN (t);
2581 CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
2584 t = TYPE_IDENTIFIER ($<ttype>0);
2585 if (t && IDENTIFIER_TEMPLATE (t))
2586 overload_template_name (t, 1);
2594 $$ = build_self_reference ();
2598 opt.component_decl_list:
2600 { if ($$) $$ = build_tree_list (access_public_node, $$); }
2601 | self_reference component_decl_list
2603 if (current_aggr == signature_type_node)
2604 $$ = build_tree_list (access_public_node, $2);
2606 $$ = build_tree_list (access_default_node, $2);
2607 if ($1) $$ = tree_cons (access_public_node, $1, $$);
2609 | opt.component_decl_list VISSPEC ':' component_decl_list
2613 if (current_aggr == signature_type_node)
2615 error ("access specifier not allowed in signature");
2616 visspec = access_public_node;
2618 $$ = chainon ($$, build_tree_list (visspec, $4));
2620 | opt.component_decl_list VISSPEC ':'
2622 if (current_aggr == signature_type_node)
2623 error ("access specifier not allowed in signature");
2627 /* Note: we no longer warn about the semicolon after a component_decl_list.
2628 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2629 component_decl_list:
2631 { if ($$ == void_type_node) $$ = NULL_TREE;
2633 | component_decl_list component_decl
2634 { /* In pushdecl, we created a reverse list of names
2635 in this binding level. Make sure that the chain
2636 of what we're trying to add isn't the item itself
2637 (which can happen with what pushdecl's doing). */
2638 if ($2 != NULL_TREE && $2 != void_type_node)
2640 if (TREE_CHAIN ($2) != $$)
2641 $$ = chainon ($$, $2);
2649 component_decl_1 ';'
2651 | component_decl_1 '}'
2652 { error ("missing ';' before right brace");
2653 yyungetc ('}', 0); }
2654 /* C++: handle constructors, destructors and inline functions */
2655 /* note that INLINE is like a TYPESPEC */
2656 | fn.def2 ':' /* base_init compstmt */
2657 { $$ = finish_method ($$); }
2658 | fn.def2 TRY /* base_init compstmt */
2659 { $$ = finish_method ($$); }
2660 | fn.def2 RETURN /* base_init compstmt */
2661 { $$ = finish_method ($$); }
2662 | fn.def2 '{' /* nodecls compstmt */
2663 { $$ = finish_method ($$); }
2666 | extension component_decl
2668 pedantic = $<itype>1; }
2672 /* Do not add a "typed_declspecs declarator" rule here for
2673 speed; we need to call grok_x_components for enums, so the
2674 speedup would be insignificant. */
2675 typed_declspecs components
2676 { $$ = grok_x_components ($1.t, $2); }
2677 | declmods notype_components
2678 { $$ = grok_x_components ($1, $2); }
2679 | notype_declarator maybeasm maybe_attribute maybe_init
2680 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2681 build_tree_list ($3, NULL_TREE)); }
2682 | constructor_declarator maybeasm maybe_attribute maybe_init
2683 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2684 build_tree_list ($3, NULL_TREE)); }
2685 | ':' expr_no_commas
2686 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2690 /* These rules introduce a reduce/reduce conflict; in
2691 typedef int foo, bar;
2695 should "A::foo" be declared as a function or "A::bar" as a data
2696 member? In other words, is "bar" an after_type_declarator or a
2698 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2699 { tree specs, attrs;
2700 split_specs_attrs ($1, &specs, &attrs);
2701 $$ = grokfield ($2, specs, $5, $3,
2702 build_tree_list ($4, attrs)); }
2703 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2704 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2705 build_tree_list ($3, NULL_TREE)); }
2707 { $$ = do_class_using_decl ($1); }
2710 /* The case of exactly one component is handled directly by component_decl. */
2713 /* empty: possibly anonymous */
2715 | component_declarator0
2716 | components ',' component_declarator
2718 /* In this context, void_type_node encodes
2719 friends. They have been recorded elsewhere. */
2720 if ($$ == void_type_node)
2723 $$ = chainon ($$, $3);
2728 /* empty: possibly anonymous */
2730 | notype_component_declarator0
2731 | notype_components ',' notype_component_declarator
2733 /* In this context, void_type_node encodes
2734 friends. They have been recorded elsewhere. */
2735 if ($$ == void_type_node)
2738 $$ = chainon ($$, $3);
2742 component_declarator0:
2743 after_type_component_declarator0
2744 | notype_component_declarator0
2747 component_declarator:
2748 after_type_component_declarator
2749 | notype_component_declarator
2752 after_type_component_declarator0:
2753 after_type_declarator maybeasm maybe_attribute maybe_init
2754 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2755 &prefix_attributes);
2756 $<ttype>0 = current_declspecs;
2757 $$ = grokfield ($$, current_declspecs, $4, $2,
2758 build_tree_list ($3, prefix_attributes)); }
2759 | TYPENAME ':' expr_no_commas maybe_attribute
2760 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2761 &prefix_attributes);
2762 $<ttype>0 = current_declspecs;
2763 $$ = grokbitfield ($$, current_declspecs, $3);
2764 cplus_decl_attributes ($$, $4, prefix_attributes); }
2767 notype_component_declarator0:
2768 notype_declarator maybeasm maybe_attribute maybe_init
2769 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2770 &prefix_attributes);
2771 $<ttype>0 = current_declspecs;
2772 $$ = grokfield ($$, current_declspecs, $4, $2,
2773 build_tree_list ($3, prefix_attributes)); }
2774 | constructor_declarator maybeasm maybe_attribute maybe_init
2775 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2776 &prefix_attributes);
2777 $<ttype>0 = current_declspecs;
2778 $$ = grokfield ($$, current_declspecs, $4, $2,
2779 build_tree_list ($3, prefix_attributes)); }
2780 | IDENTIFIER ':' expr_no_commas maybe_attribute
2781 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2782 &prefix_attributes);
2783 $<ttype>0 = current_declspecs;
2784 $$ = grokbitfield ($$, current_declspecs, $3);
2785 cplus_decl_attributes ($$, $4, prefix_attributes); }
2786 | ':' expr_no_commas maybe_attribute
2787 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2788 &prefix_attributes);
2789 $<ttype>0 = current_declspecs;
2790 $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2791 cplus_decl_attributes ($$, $3, prefix_attributes); }
2794 after_type_component_declarator:
2795 after_type_declarator maybeasm maybe_attribute maybe_init
2796 { $$ = grokfield ($$, current_declspecs, $4, $2,
2797 build_tree_list ($3, prefix_attributes)); }
2798 | TYPENAME ':' expr_no_commas maybe_attribute
2799 { $$ = grokbitfield ($$, current_declspecs, $3);
2800 cplus_decl_attributes ($$, $4, prefix_attributes); }
2803 notype_component_declarator:
2804 notype_declarator maybeasm maybe_attribute maybe_init
2805 { $$ = grokfield ($$, current_declspecs, $4, $2,
2806 build_tree_list ($3, prefix_attributes)); }
2807 | IDENTIFIER ':' expr_no_commas maybe_attribute
2808 { $$ = grokbitfield ($$, current_declspecs, $3);
2809 cplus_decl_attributes ($$, $4, prefix_attributes); }
2810 | ':' expr_no_commas maybe_attribute
2811 { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2812 cplus_decl_attributes ($$, $3, prefix_attributes); }
2815 /* We chain the enumerators in reverse order.
2816 Because of the way enums are built, the order is
2817 insignificant. Take advantage of this fact. */
2821 | enumlist ',' enumerator
2822 { TREE_CHAIN ($3) = $$; $$ = $3; }
2827 { $$ = build_enumerator ($$, NULL_TREE); }
2828 | identifier '=' expr_no_commas
2829 { $$ = build_enumerator ($$, $3); }
2832 /* ANSI new-type-id (5.3.4) */
2834 type_specifier_seq new_declarator
2835 { $$.t = build_decl_list ($1.t, $2);
2836 $$.new_type_flag = $1.new_type_flag; }
2837 | type_specifier_seq %prec EMPTY
2838 { $$.t = build_decl_list ($1.t, NULL_TREE);
2839 $$.new_type_flag = $1.new_type_flag; }
2840 /* GNU extension to allow arrays of arbitrary types with
2841 non-constant dimension. */
2842 | '(' type_id ')' '[' expr ']'
2845 pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
2846 $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
2847 $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
2848 $$.new_type_flag = $2.new_type_flag;
2853 /* empty */ %prec EMPTY
2855 | cv_qualifiers CV_QUALIFIER
2856 { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
2859 nonempty_cv_qualifiers:
2861 { $$.t = IDENTIFIER_AS_LIST ($1);
2862 $$.new_type_flag = 0; }
2863 | nonempty_cv_qualifiers CV_QUALIFIER
2864 { $$.t = decl_tree_cons (NULL_TREE, $2, $1.t);
2865 $$.new_type_flag = $1.new_type_flag; }
2868 /* These rules must follow the rules for function declarations
2869 and component declarations. That way, longer rules are preferred. */
2873 { $<itype>$ = suspend_momentary (); }
2875 /* An expression which will not live on the momentary obstack. */
2878 { resume_momentary ((int) $<itype>1); $$ = $2; }
2881 /* An expression which will not live on the momentary obstack. */
2883 suspend_mom '(' nonnull_exprlist ')'
2884 { resume_momentary ((int) $<itype>1); $$ = $3; }
2885 | suspend_mom '(' parmlist ')'
2886 { resume_momentary ((int) $<itype>1); $$ = $3; }
2887 | suspend_mom LEFT_RIGHT
2888 { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
2889 | suspend_mom '(' error ')'
2890 { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
2893 /* A declarator that is allowed only after an explicit typespec. */
2894 /* may all be followed by prec '.' */
2895 after_type_declarator:
2896 '*' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2897 { $$ = make_pointer_declarator ($2.t, $3); }
2898 | '&' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2899 { $$ = make_reference_declarator ($2.t, $3); }
2900 | '*' after_type_declarator %prec UNARY
2901 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2902 | '&' after_type_declarator %prec UNARY
2903 { $$ = make_reference_declarator (NULL_TREE, $2); }
2904 | ptr_to_mem cv_qualifiers after_type_declarator
2905 { tree arg = make_pointer_declarator ($2, $3);
2906 $$ = build_parse_node (SCOPE_REF, $1, arg);
2908 | direct_after_type_declarator
2912 type_name %prec EMPTY
2914 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2916 if (current_class_type
2917 && TYPE_BEING_DEFINED (current_class_type)
2918 && ! IDENTIFIER_CLASS_VALUE ($1))
2920 /* Be sure to get an inherited typedef. */
2921 $$ = lookup_name ($1, 1);
2922 /* Remember that this name has been used in the class
2923 definition, as per [class.scope0] */
2924 pushdecl_class_level ($$);
2927 $$ = identifier_typedecl_value ($1);
2932 | global_scope type_name
2934 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2935 $$ = identifier_typedecl_value ($2);
2938 got_scope = NULL_TREE;
2941 | global_scope nested_type
2946 nested_name_specifier type_name %prec EMPTY
2947 { $$ = get_type_decl ($2); }
2950 direct_after_type_declarator:
2951 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2952 { $$ = make_call_declarator ($$, $2, $3, $4); }
2953 | direct_after_type_declarator '[' nonmomentary_expr ']'
2954 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2955 | direct_after_type_declarator '[' ']'
2956 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2957 | '(' after_type_declarator ')'
2959 | nested_name_specifier type_name %prec EMPTY
2960 { push_nested_class ($1, 3);
2961 $$ = build_parse_node (SCOPE_REF, $$, $2);
2962 TREE_COMPLEXITY ($$) = current_class_depth; }
2963 | type_name %prec EMPTY
2966 /* A declarator allowed whether or not there has been
2967 an explicit typespec. These cannot redeclare a typedef-name. */
2970 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2971 { $$ = make_pointer_declarator ($2.t, $3); }
2972 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2973 { $$ = make_reference_declarator ($2.t, $3); }
2974 | '*' notype_declarator %prec UNARY
2975 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2976 | '&' notype_declarator %prec UNARY
2977 { $$ = make_reference_declarator (NULL_TREE, $2); }
2978 | ptr_to_mem cv_qualifiers notype_declarator
2979 { tree arg = make_pointer_declarator ($2, $3);
2980 $$ = build_parse_node (SCOPE_REF, $1, arg);
2982 | direct_notype_declarator
2985 complex_notype_declarator:
2986 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2987 { $$ = make_pointer_declarator ($2.t, $3); }
2988 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2989 { $$ = make_reference_declarator ($2.t, $3); }
2990 | '*' complex_notype_declarator %prec UNARY
2991 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2992 | '&' complex_notype_declarator %prec UNARY
2993 { $$ = make_reference_declarator (NULL_TREE, $2); }
2994 | ptr_to_mem cv_qualifiers notype_declarator
2995 { tree arg = make_pointer_declarator ($2, $3);
2996 $$ = build_parse_node (SCOPE_REF, $1, arg);
2998 | complex_direct_notype_declarator
3001 complex_direct_notype_declarator:
3002 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
3003 { $$ = make_call_declarator ($$, $2, $3, $4); }
3004 | '(' complex_notype_declarator ')'
3006 | direct_notype_declarator '[' nonmomentary_expr ']'
3007 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3008 | direct_notype_declarator '[' ']'
3009 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3010 | notype_qualified_id
3011 { if (OP0 ($$) != current_class_type)
3013 push_nested_class (OP0 ($$), 3);
3014 TREE_COMPLEXITY ($$) = current_class_depth;
3020 nested_name_specifier unqualified_id
3021 { got_scope = NULL_TREE;
3022 $$ = build_parse_node (SCOPE_REF, $$, $2); }
3025 notype_qualified_id:
3026 nested_name_specifier notype_unqualified_id
3027 { got_scope = NULL_TREE;
3028 $$ = build_parse_node (SCOPE_REF, $$, $2); }
3033 | global_scope notype_qualified_id
3038 typespec '(' nonnull_exprlist ')'
3039 { $$ = build_functional_cast ($1.t, $3); }
3040 | typespec '(' expr_or_declarator ')'
3041 { $$ = reparse_decl_as_expr ($1.t, $3); }
3042 | typespec fcast_or_absdcl %prec EMPTY
3043 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3049 | template_type %prec EMPTY
3052 nested_name_specifier:
3053 nested_name_specifier_1
3054 | nested_name_specifier nested_name_specifier_1
3058 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3059 inline here?!? (jason) */
3060 nested_name_specifier_1:
3063 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3066 /* Remember that this name has been used in the class
3067 definition, as per [class.scope0] */
3068 if (current_class_type
3069 && TYPE_BEING_DEFINED (current_class_type)
3070 && ! IDENTIFIER_CLASS_VALUE ($1))
3071 pushdecl_class_level ($$);
3073 got_scope = $$ = TREE_TYPE ($$);
3077 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3079 got_scope = $$ = TREE_TYPE ($$);
3083 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3085 if (TREE_CODE ($$) == NAMESPACE_DECL
3086 && DECL_NAME ($$) == get_identifier ("std"))
3087 got_scope = void_type_node;
3091 | template_type SCOPE
3092 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3093 /* These break 'const i;'
3097 cp_error ("`%D' is not an aggregate typedef",
3098 lastiddecl ? lastiddecl : $$);
3099 $$ = error_mark_node;
3102 { goto failed_scope; } */
3106 global_scope type_name
3108 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3109 $$ = identifier_typedecl_value ($2);
3112 got_scope = NULL_TREE;
3115 | global_scope nested_type
3120 nested_name_specifier '*'
3121 { got_scope = NULL_TREE; }
3122 | global_scope nested_name_specifier '*'
3123 { $$ = $2; got_scope = NULL_TREE; }
3126 /* All uses of explicit global scope must go through this nonterminal so
3127 that got_scope will be set before yylex is called to get the next token. */
3130 { got_scope = void_type_node; }
3133 /* ANSI new-declarator (5.3.4) */
3135 '*' cv_qualifiers new_declarator
3136 { $$ = make_pointer_declarator ($2, $3); }
3137 | '*' cv_qualifiers %prec EMPTY
3138 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3139 | '&' cv_qualifiers new_declarator %prec EMPTY
3140 { $$ = make_reference_declarator ($2, $3); }
3141 | '&' cv_qualifiers %prec EMPTY
3142 { $$ = make_reference_declarator ($2, NULL_TREE); }
3143 | ptr_to_mem cv_qualifiers %prec EMPTY
3144 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3145 $$ = build_parse_node (SCOPE_REF, $1, arg);
3147 | ptr_to_mem cv_qualifiers new_declarator
3148 { tree arg = make_pointer_declarator ($2, $3);
3149 $$ = build_parse_node (SCOPE_REF, $1, arg);
3151 | direct_new_declarator %prec EMPTY
3154 /* ANSI direct-new-declarator (5.3.4) */
3155 direct_new_declarator:
3157 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3158 | direct_new_declarator '[' nonmomentary_expr ']'
3159 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3162 /* ANSI abstract-declarator (8.1) */
3164 '*' nonempty_cv_qualifiers absdcl
3165 { $$ = make_pointer_declarator ($2.t, $3); }
3167 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3168 | '*' nonempty_cv_qualifiers %prec EMPTY
3169 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3171 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3172 | '&' nonempty_cv_qualifiers absdcl
3173 { $$ = make_reference_declarator ($2.t, $3); }
3175 { $$ = make_reference_declarator (NULL_TREE, $2); }
3176 | '&' nonempty_cv_qualifiers %prec EMPTY
3177 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3179 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3180 | ptr_to_mem cv_qualifiers %prec EMPTY
3181 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3182 $$ = build_parse_node (SCOPE_REF, $1, arg);
3184 | ptr_to_mem cv_qualifiers absdcl
3185 { tree arg = make_pointer_declarator ($2, $3);
3186 $$ = build_parse_node (SCOPE_REF, $1, arg);
3188 | direct_abstract_declarator %prec EMPTY
3191 /* ANSI direct-abstract-declarator (8.1) */
3192 direct_abstract_declarator:
3195 /* `(typedef)1' is `int'. */
3197 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3198 { $$ = make_call_declarator ($$, $3, $5, $6); }
3199 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3200 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3201 | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
3202 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3203 | direct_abstract_declarator '[' ']' %prec '.'
3204 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3205 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3206 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3207 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3208 { set_quals_and_spec ($$, $2, $3); }
3209 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3210 { set_quals_and_spec ($$, $2, $3); }
3211 | '[' nonmomentary_expr ']' %prec '.'
3212 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3214 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
3217 /* For C++, decls and stmts can be intermixed, so we don't need to
3218 have a special rule that won't start parsing the stmt section
3219 until we have a stmt that parses without errors. */
3232 /* build the LET_STMT node before parsing its contents,
3233 so that any LET_STMTs within the context can have their display pointers
3234 set up to point at this one. */
3238 { do_pushlevel (); }
3243 { $$ = do_poplevel (); }
3246 /* Read zero or more forward-declarations for labels
3247 that nested functions can jump to. */
3252 pedwarn ("ANSI C++ forbids label declarations"); }
3257 | label_decls label_decl
3261 LABEL identifiers_or_typenames ';'
3263 for (link = $2; link; link = TREE_CHAIN (link))
3265 tree label = shadow_label (TREE_VALUE (link));
3266 C_DECLARED_LABEL_FLAG (label) = 1;
3267 declare_nonlocal_label (label);
3272 /* This is the body of a function definition.
3273 It causes syntax errors to ignore to the next openbrace. */
3283 if (processing_template_decl)
3285 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3286 add_tree ($<ttype>$);
3289 .pushlevel compstmtend .poplevel
3291 if (processing_template_decl)
3293 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3294 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3295 last_tree = $<ttype>2;
3304 if (processing_template_decl)
3306 $<ttype>$ = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE,
3308 add_tree ($<ttype>$);
3310 cond_stmt_keyword = "if";
3312 .pushlevel paren_cond_or_null
3314 if (processing_template_decl)
3316 if (last_tree != $<ttype>2)
3318 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3319 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3320 last_tree = $<ttype>2;
3323 TREE_OPERAND ($<ttype>2, 0) = $4;
3327 emit_line_note (input_filename, lineno);
3328 expand_start_cond ($4, 0);
3331 implicitly_scoped_stmt
3333 if (processing_template_decl)
3335 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3336 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3337 $<ttype>$ = last_tree = $<ttype>2;
3342 implicitly_scoped_stmt:
3347 if (processing_template_decl)
3349 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3350 add_tree ($<ttype>$);
3353 simple_stmt .poplevel
3355 if (processing_template_decl)
3357 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3358 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3359 last_tree = $<ttype>2;
3377 if (! processing_template_decl)
3379 emit_line_note (input_filename, lineno);
3380 /* Do default conversion if safe and possibly important,
3381 in case within ({...}). */
3382 if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
3384 || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
3385 expr = default_conversion (expr);
3387 cplus_expand_expr_stmt (expr);
3391 { if (! processing_template_decl) expand_start_else (); }
3392 implicitly_scoped_stmt
3394 if (processing_template_decl)
3396 TREE_OPERAND ($<ttype>1, 2) = TREE_CHAIN ($<ttype>1);
3397 TREE_CHAIN ($<ttype>1) = NULL_TREE;
3398 last_tree = $<ttype>1;
3405 | simple_if %prec IF
3406 { if (! processing_template_decl) expand_end_cond ();
3411 if (processing_template_decl)
3413 $<ttype>$ = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
3414 add_tree ($<ttype>$);
3419 emit_line_note (input_filename, lineno);
3420 expand_start_loop (1);
3422 cond_stmt_keyword = "while";
3424 .pushlevel paren_cond_or_null
3426 if (processing_template_decl)
3428 if (last_tree != $<ttype>2)
3430 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3431 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3432 last_tree = $<ttype>2;
3435 TREE_OPERAND ($<ttype>2, 0) = $4;
3439 emit_line_note (input_filename, lineno);
3440 expand_exit_loop_if_false (0, $4);
3443 already_scoped_stmt .poplevel
3445 if (processing_template_decl)
3447 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3448 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3449 last_tree = $<ttype>2;
3457 if (processing_template_decl)
3459 $<ttype>$ = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
3460 add_tree ($<ttype>$);
3465 emit_line_note (input_filename, lineno);
3466 expand_start_loop_continue_elsewhere (1);
3469 implicitly_scoped_stmt WHILE
3471 if (processing_template_decl)
3473 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3474 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3475 last_tree = $<ttype>2;
3479 expand_loop_continue_here ();
3480 cond_stmt_keyword = "do";
3483 paren_expr_or_null ';'
3485 if (processing_template_decl)
3486 TREE_OPERAND ($<ttype>2, 1) = $6;
3489 emit_line_note (input_filename, lineno);
3490 expand_exit_loop_if_false (0, $6);
3497 { if (processing_template_decl)
3499 $<ttype>$ = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
3500 NULL_TREE, NULL_TREE);
3501 add_tree ($<ttype>$);
3504 emit_line_note (input_filename, lineno);
3505 if (flag_new_for_scope > 0)
3507 /* Conditionalize .pushlevel */
3509 note_level_for_for ();
3512 expand_start_bindings (0);
3515 '(' for.init.statement
3517 if (processing_template_decl)
3519 if (last_tree != $<ttype>2)
3521 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3522 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3523 last_tree = $<ttype>2;
3529 emit_line_note (input_filename, lineno);
3530 expand_start_loop_continue_elsewhere (1);
3533 .pushlevel xcond ';'
3535 if (processing_template_decl)
3537 if (last_tree != $<ttype>2)
3539 TREE_OPERAND ($<ttype>2, 1) = last_tree;
3540 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3541 last_tree = $<ttype>2;
3544 TREE_OPERAND ($<ttype>2, 1) = $7;
3548 emit_line_note (input_filename, lineno);
3549 if ($7) expand_exit_loop_if_false (0, $7);
3553 /* Don't let the tree nodes for $10 be discarded
3554 by clear_momentary during the parsing of the next stmt. */
3556 if (processing_template_decl)
3557 TREE_OPERAND ($<ttype>2, 2) = $10;
3560 already_scoped_stmt .poplevel
3562 if (processing_template_decl)
3564 TREE_OPERAND ($<ttype>2, 3) = TREE_CHAIN ($<ttype>2);
3565 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3566 last_tree = $<ttype>2;
3570 emit_line_note (input_filename, lineno);
3571 expand_loop_continue_here ();
3572 if ($10) cplus_expand_expr_stmt ($10);
3576 if (flag_new_for_scope > 0)
3581 | SWITCH .pushlevel '(' condition ')'
3583 if (processing_template_decl)
3585 $<ttype>$ = build_min_nt (SWITCH_STMT, $4, NULL_TREE);
3586 add_tree ($<ttype>$);
3590 emit_line_note (input_filename, lineno);
3591 c_expand_start_case ($4);
3594 /* Don't let the tree nodes for $4 be discarded by
3595 clear_momentary during the parsing of the next stmt. */
3598 implicitly_scoped_stmt
3600 if (processing_template_decl)
3602 TREE_OPERAND ($<ttype>6, 1) = TREE_CHAIN ($<ttype>6);
3603 TREE_CHAIN ($<ttype>6) = NULL_TREE;
3604 last_tree = $<ttype>6;
3607 expand_end_case ($4);
3613 | CASE expr_no_commas ':'
3614 { do_case ($2, NULL_TREE); }
3616 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3617 { do_case ($2, $4); }
3620 { do_case (NULL_TREE, NULL_TREE); }
3623 { emit_line_note (input_filename, lineno);
3624 if (processing_template_decl)
3625 add_tree (build_min_nt (BREAK_STMT));
3626 else if ( ! expand_exit_something ())
3627 error ("break statement not within loop or switch"); }
3629 { emit_line_note (input_filename, lineno);
3630 if (processing_template_decl)
3631 add_tree (build_min_nt (CONTINUE_STMT));
3632 else if (! expand_continue_loop (0))
3633 error ("continue statement not within a loop"); }
3635 { emit_line_note (input_filename, lineno);
3636 c_expand_return (NULL_TREE); }
3638 { emit_line_note (input_filename, lineno);
3639 c_expand_return ($2);
3642 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3643 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3644 emit_line_note (input_filename, lineno);
3648 /* This is the case with just output operands. */
3649 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3650 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3651 emit_line_note (input_filename, lineno);
3652 c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
3653 $2 == ridpointers[(int)RID_VOLATILE],
3654 input_filename, lineno);
3657 /* This is the case with input operands as well. */
3658 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
3659 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3660 emit_line_note (input_filename, lineno);
3661 c_expand_asm_operands ($4, $6, $8, NULL_TREE,
3662 $2 == ridpointers[(int)RID_VOLATILE],
3663 input_filename, lineno);
3666 /* This is the case with clobbered registers as well. */
3667 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3668 asm_operands ':' asm_clobbers ')' ';'
3669 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3670 emit_line_note (input_filename, lineno);
3671 c_expand_asm_operands ($4, $6, $8, $10,
3672 $2 == ridpointers[(int)RID_VOLATILE],
3673 input_filename, lineno);
3678 if (processing_template_decl)
3679 add_tree (build_min_nt (GOTO_STMT, $3));
3681 { emit_line_note (input_filename, lineno);
3682 expand_computed_goto ($3); }
3684 | GOTO identifier ';'
3686 if (processing_template_decl)
3687 add_tree (build_min_nt (GOTO_STMT, $2));
3691 emit_line_note (input_filename, lineno);
3692 decl = lookup_label ($2);
3693 TREE_USED (decl) = 1;
3700 { error ("label must be followed by statement");
3711 if (! current_function_parms_stored)
3712 store_parm_decls ();
3713 expand_start_early_try_stmts ();
3715 ctor_initializer_opt compstmt_or_error
3716 { expand_start_all_catch (); }
3719 int nested = (hack_decl_function_context
3720 (current_function_decl) != NULL_TREE);
3721 expand_end_all_catch ();
3722 finish_function (lineno, (int)$3, nested);
3729 if (processing_template_decl)
3731 $<ttype>$ = build_min_nt (TRY_BLOCK, NULL_TREE,
3733 add_tree ($<ttype>$);
3737 emit_line_note (input_filename, lineno);
3738 expand_start_try_stmts ();
3743 if (processing_template_decl)
3745 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3746 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3747 last_tree = $<ttype>2;
3750 expand_start_all_catch ();
3754 if (processing_template_decl)
3756 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3757 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3758 last_tree = $<ttype>2;
3761 expand_end_all_catch ();
3767 | handler_seq handler
3773 if (processing_template_decl)
3775 $<ttype>$ = build_min_nt (HANDLER, NULL_TREE,
3777 add_tree ($<ttype>$);
3780 .pushlevel handler_args
3782 if (processing_template_decl)
3784 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3785 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3786 last_tree = $<ttype>2;
3791 if (processing_template_decl)
3793 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3794 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3795 last_tree = $<ttype>2;
3798 expand_end_catch_block ();
3804 typed_typespecs %prec EMPTY
3805 | nonempty_cv_qualifiers %prec EMPTY
3810 { expand_start_catch_block (NULL_TREE, NULL_TREE); }
3811 /* This doesn't allow reference parameters, the below does.
3812 | '(' type_specifier_seq absdcl ')'
3813 { check_for_new_type ("inside exception declarations", $2);
3814 expand_start_catch_block ($2.t, $3); }
3815 | '(' type_specifier_seq ')'
3816 { check_for_new_type ("inside exception declarations", $2);
3817 expand_start_catch_block ($2.t, NULL_TREE); }
3818 | '(' type_specifier_seq notype_declarator ')'
3819 { check_for_new_type ("inside exception declarations", $2);
3820 expand_start_catch_block ($2.t, $3); }
3821 | '(' typed_typespecs after_type_declarator ')'
3822 { check_for_new_type ("inside exception declarations", $2);
3823 expand_start_catch_block ($2.t, $3); }
3824 This allows reference parameters... */
3826 { check_for_new_type ("inside exception declarations", $2);
3827 expand_start_catch_block (TREE_PURPOSE ($2.t),
3828 TREE_VALUE ($2.t)); }
3835 label = define_label (input_filename, lineno, $1);
3836 if (label && ! minimal_parse_mode)
3837 expand_label (label);
3849 { if ($1) cplus_expand_expr_stmt ($1); }
3853 pedwarn ("ANSI C++ forbids compound statements inside for initializations");
3857 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3861 { emit_line_note (input_filename, lineno);
3864 { emit_line_note (input_filename, lineno); }
3875 /* These are the operands other than the first string and colon
3876 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3880 | nonnull_asm_operands
3883 nonnull_asm_operands:
3885 | nonnull_asm_operands ',' asm_operand
3886 { $$ = chainon ($$, $3); }
3891 { $$ = build_tree_list ($$, $3); }
3896 { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
3897 | asm_clobbers ',' STRING
3898 { $$ = tree_cons (NULL_TREE, $3, $$); }
3901 /* This is what appears inside the parens in a function declarator.
3902 Its value is represented in the format that grokdeclarator expects.
3904 In C++, declaring a function with no parameters
3905 means that that function takes *no* parameters. */
3914 { $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3915 TREE_PARMLIST ($$) = 1;
3916 check_for_new_type ("inside parameter list", $1); }
3919 /* This nonterminal does not include the common sequence '(' type_id ')',
3920 as it is ambiguous and must be disambiguated elsewhere. */
3924 $$ = chainon ($$, void_list_node);
3925 TREE_PARMLIST ($$) = 1;
3927 | parms_comma ELLIPSIS
3929 TREE_PARMLIST ($$) = 1;
3931 /* C++ allows an ellipsis without a separating ',' */
3934 TREE_PARMLIST ($$) = 1;
3938 $$ = build_tree_list (NULL_TREE, $1.t);
3939 TREE_PARMLIST ($$) = 1;
3947 TREE_PARMLIST ($$) = 1;
3949 | parms TYPENAME_ELLIPSIS
3951 TREE_PARMLIST ($$) = 1;
3953 | type_id TYPENAME_ELLIPSIS
3955 $$ = build_tree_list (NULL_TREE, $1.t);
3956 TREE_PARMLIST ($$) = 1;
3960 /* This helps us recover from really nasty
3961 parse errors, for example, a missing right
3963 yyerror ("possibly missing ')'");
3964 $$ = chainon ($$, void_list_node);
3965 TREE_PARMLIST ($$) = 1;
3971 /* This helps us recover from really nasty
3972 parse errors, for example, a missing right
3974 yyerror ("possibly missing ')'");
3975 $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3976 TREE_PARMLIST ($$) = 1;
3982 /* A default argument to a */
3985 { maybe_snarf_defarg (); }
3995 /* A nonempty list of parameter declarations or type names. */
3998 { check_for_new_type ("in a parameter list", $1);
3999 $$ = build_tree_list (NULL_TREE, $1.t); }
4001 { check_for_new_type ("in a parameter list", $1);
4002 $$ = build_tree_list ($2, $1.t); }
4003 | parms_comma full_parm
4004 { check_for_new_type ("in a parameter list", $2);
4005 $$ = chainon ($$, $2.t); }
4006 | parms_comma bad_parm
4007 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
4008 | parms_comma bad_parm '=' init
4009 { $$ = chainon ($$, build_tree_list ($4, $2)); }
4015 { check_for_new_type ("in a parameter list", $1);
4016 $$ = build_tree_list (NULL_TREE, $1.t); }
4019 /* A single parameter declaration or parameter type name,
4020 as found in a parmlist. */
4022 /* Here we expand typed_declspecs inline to avoid mis-parsing of
4023 TYPESPEC IDENTIFIER. */
4024 typed_declspecs1 declarator
4025 { tree specs = strip_attrs ($1.t);
4026 $$.new_type_flag = $1.new_type_flag;
4027 $$.t = build_tree_list (specs, $2); }
4028 | typed_typespecs declarator
4029 { $$.t = build_tree_list ($1.t, $2);
4030 $$.new_type_flag = $1.new_type_flag; }
4031 | typespec declarator
4032 { $$.t = build_tree_list (get_decl_list ($1.t), $2);
4033 $$.new_type_flag = $1.new_type_flag; }
4034 | typed_declspecs1 absdcl
4035 { tree specs = strip_attrs ($1.t);
4036 $$.t = build_tree_list (specs, $2);
4037 $$.new_type_flag = $1.new_type_flag; }
4038 | typed_declspecs1 %prec EMPTY
4039 { tree specs = strip_attrs ($1.t);
4040 $$.t = build_tree_list (specs, NULL_TREE);
4041 $$.new_type_flag = $1.new_type_flag; }
4042 | declmods notype_declarator
4043 { tree specs = strip_attrs ($1);
4044 $$.t = build_tree_list (specs, $2);
4045 $$.new_type_flag = 0; }
4050 { $$.t = build_tree_list (NULL_TREE, $1.t);
4051 $$.new_type_flag = $1.new_type_flag; }
4053 { $$.t = build_tree_list ($2, $1.t);
4054 $$.new_type_flag = $1.new_type_flag; }
4063 /* empty */ %prec EMPTY
4064 { see_typename (); }
4068 /* empty */ %prec EMPTY
4070 error ("type specifier omitted for parameter");
4071 $$ = build_tree_list (integer_type_node, NULL_TREE);
4075 error ("type specifier omitted for parameter");
4076 if (TREE_CODE ($$) == SCOPE_REF
4077 && TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM)
4078 cp_error (" perhaps you want `typename %E' to make it a type", $$);
4079 $$ = build_tree_list (integer_type_node, $$);
4083 exception_specification_opt:
4084 /* empty */ %prec EMPTY
4086 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
4088 | THROW LEFT_RIGHT %prec EMPTY
4089 { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
4092 ansi_raise_identifier:
4094 { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
4097 ansi_raise_identifiers:
4098 ansi_raise_identifier
4099 | ansi_raise_identifiers ',' ansi_raise_identifier
4101 TREE_CHAIN ($3) = $$;
4106 conversion_declarator:
4107 /* empty */ %prec EMPTY
4109 | '*' cv_qualifiers conversion_declarator
4110 { $$ = make_pointer_declarator ($2, $3); }
4111 | '&' cv_qualifiers conversion_declarator
4112 { $$ = make_reference_declarator ($2, $3); }
4113 | ptr_to_mem cv_qualifiers conversion_declarator
4114 { tree arg = make_pointer_declarator ($2, $3);
4115 $$ = build_parse_node (SCOPE_REF, $1, arg);
4121 { got_scope = NULL_TREE; }
4126 { $$ = ansi_opname[MULT_EXPR]; }
4128 { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
4130 { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
4132 { $$ = ansi_opname[PLUS_EXPR]; }
4134 { $$ = ansi_opname[MINUS_EXPR]; }
4136 { $$ = ansi_opname[BIT_AND_EXPR]; }
4138 { $$ = ansi_opname[BIT_IOR_EXPR]; }
4140 { $$ = ansi_opname[BIT_XOR_EXPR]; }
4142 { $$ = ansi_opname[BIT_NOT_EXPR]; }
4144 { $$ = ansi_opname[COMPOUND_EXPR]; }
4145 | operator ARITHCOMPARE
4146 { $$ = ansi_opname[$2]; }
4148 { $$ = ansi_opname[LT_EXPR]; }
4150 { $$ = ansi_opname[GT_EXPR]; }
4151 | operator EQCOMPARE
4152 { $$ = ansi_opname[$2]; }
4154 { $$ = ansi_assopname[$2]; }
4156 { $$ = ansi_opname [MODIFY_EXPR]; }
4158 { $$ = ansi_opname[$2]; }
4160 { $$ = ansi_opname[$2]; }
4162 { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
4163 | operator MINUSMINUS
4164 { $$ = ansi_opname[PREDECREMENT_EXPR]; }
4166 { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
4168 { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
4170 { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
4172 { $$ = ansi_opname[COND_EXPR]; }
4174 { $$ = ansi_opname[$2]; }
4175 | operator POINTSAT %prec EMPTY
4176 { $$ = ansi_opname[COMPONENT_REF]; }
4177 | operator POINTSAT_STAR %prec EMPTY
4178 { $$ = ansi_opname[MEMBER_REF]; }
4179 | operator LEFT_RIGHT
4180 { $$ = ansi_opname[CALL_EXPR]; }
4182 { $$ = ansi_opname[ARRAY_REF]; }
4183 | operator NEW %prec EMPTY
4184 { $$ = ansi_opname[NEW_EXPR]; }
4185 | operator DELETE %prec EMPTY
4186 { $$ = ansi_opname[DELETE_EXPR]; }
4187 | operator NEW '[' ']'
4188 { $$ = ansi_opname[VEC_NEW_EXPR]; }
4189 | operator DELETE '[' ']'
4190 { $$ = ansi_opname[VEC_DELETE_EXPR]; }
4191 /* Names here should be looked up in class scope ALSO. */
4192 | operator type_specifier_seq conversion_declarator
4193 { $$ = grokoptypename ($2.t, $3); }
4195 { $$ = ansi_opname[ERROR_MARK]; }
4202 debug_yytranslate (value)
4205 return yytname[YYTRANSLATE (value)];