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())
366 fndef eat_saved_input
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 eat_saved_input
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
543 | fn.def1 maybe_return_init error
547 constructor_declarator:
548 nested_name_specifier SELFNAME '('
550 $$ = build_parse_node (SCOPE_REF, $1, $2);
551 if ($1 != current_class_type)
553 push_nested_class ($1, 3);
554 TREE_COMPLEXITY ($$) = current_class_depth;
557 parmlist ')' cv_qualifiers exception_specification_opt
558 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
559 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
561 $$ = build_parse_node (SCOPE_REF, $1, $2);
562 if ($1 != current_class_type)
564 push_nested_class ($1, 3);
565 TREE_COMPLEXITY ($$) = current_class_depth;
567 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
569 | global_scope nested_name_specifier SELFNAME '('
571 $$ = build_parse_node (SCOPE_REF, $2, $3);
572 if ($2 != current_class_type)
574 push_nested_class ($2, 3);
575 TREE_COMPLEXITY ($$) = current_class_depth;
578 parmlist ')' cv_qualifiers exception_specification_opt
579 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
580 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
582 $$ = build_parse_node (SCOPE_REF, $2, $3);
583 if ($2 != current_class_type)
585 push_nested_class ($2, 3);
586 TREE_COMPLEXITY ($$) = current_class_depth;
588 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
590 | nested_name_specifier self_template_type '('
592 $$ = build_parse_node (SCOPE_REF, $1, $2);
593 if ($1 != current_class_type)
595 push_nested_class ($1, 3);
596 TREE_COMPLEXITY ($$) = current_class_depth;
599 parmlist ')' cv_qualifiers exception_specification_opt
600 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
601 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
603 $$ = build_parse_node (SCOPE_REF, $1, $2);
604 if ($1 != current_class_type)
606 push_nested_class ($1, 3);
607 TREE_COMPLEXITY ($$) = current_class_depth;
609 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
611 | global_scope nested_name_specifier self_template_type '('
613 $$ = build_parse_node (SCOPE_REF, $2, $3);
614 if ($2 != current_class_type)
616 push_nested_class ($2, 3);
617 TREE_COMPLEXITY ($$) = current_class_depth;
620 parmlist ')' cv_qualifiers exception_specification_opt
621 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
622 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
624 $$ = build_parse_node (SCOPE_REF, $2, $3);
625 if ($2 != current_class_type)
627 push_nested_class ($2, 3);
628 TREE_COMPLEXITY ($$) = current_class_depth;
630 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
635 typed_declspecs declarator
637 split_specs_attrs ($1.t, &specs, &attrs);
638 if (! start_function (specs, $2, attrs, 0))
640 reinit_parse_for_function ();
642 | declmods notype_declarator
644 split_specs_attrs ($1, &specs, &attrs);
645 if (! start_function (specs, $2, attrs, 0))
647 reinit_parse_for_function ();
650 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
652 reinit_parse_for_function ();
654 | declmods constructor_declarator
656 split_specs_attrs ($1, &specs, &attrs);
657 if (! start_function (specs, $2, attrs, 0))
659 reinit_parse_for_function ();
661 | constructor_declarator
662 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
664 reinit_parse_for_function ();
668 component_constructor_declarator:
669 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
670 { $$ = make_call_declarator ($1, $3, $5, $6); }
671 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
672 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
673 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
674 { $$ = make_call_declarator ($1, $3, $5, $6); }
675 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
676 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
679 /* more C++ complexity. See component_decl for a comment on the
680 reduce/reduce conflict introduced by these rules. */
682 declmods component_constructor_declarator
683 { tree specs = strip_attrs ($1);
684 $$ = start_method (specs, $2);
688 if (yychar == YYEMPTY)
690 reinit_parse_for_method (yychar, $$); }
691 | component_constructor_declarator
692 { $$ = start_method (NULL_TREE, $1); goto rest_of_mdef; }
693 | typed_declspecs declarator
694 { tree specs = strip_attrs ($1.t);
695 $$ = start_method (specs, $2); goto rest_of_mdef; }
696 | declmods notype_declarator
697 { tree specs = strip_attrs ($1);
698 $$ = start_method (specs, $2); goto rest_of_mdef; }
700 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
701 | declmods constructor_declarator
702 { tree specs = strip_attrs ($1);
703 $$ = start_method (specs, $2); goto rest_of_mdef; }
704 | constructor_declarator
705 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
711 if (! current_function_parms_stored)
719 { store_return_init ($<ttype>$, $2); }
720 | return_id '(' nonnull_exprlist ')'
721 { store_return_init ($<ttype>$, $3); }
722 | return_id LEFT_RIGHT
723 { store_return_init ($<ttype>$, NULL_TREE); }
727 ':' .set_base_init member_init_list
730 error ("no base initializers given following ':'");
732 /* Always keep the BLOCK node associated with the outermost
733 pair of curley braces of a function. These are needed
734 for correct operation of dwarfout.c. */
742 if (! current_function_parms_stored)
745 if (DECL_CONSTRUCTOR_P (current_function_decl))
747 /* Make a contour for the initializer list. */
750 expand_start_bindings (0);
752 else if (current_class_type == NULL_TREE)
753 error ("base initializers not allowed for non-member functions");
754 else if (! DECL_CONSTRUCTOR_P (current_function_decl))
755 error ("only constructors take base initializers");
764 | member_init_list ',' member_init
765 | member_init_list error
769 '(' nonnull_exprlist ')'
771 if (current_class_name)
772 pedwarn ("anachronistic old style base class initializer");
773 expand_member_init (current_class_ref, NULL_TREE, $2);
777 if (current_class_name)
778 pedwarn ("anachronistic old style base class initializer");
779 expand_member_init (current_class_ref, NULL_TREE, void_type_node);
781 | notype_identifier '(' nonnull_exprlist ')'
782 { expand_member_init (current_class_ref, $1, $3); }
783 | notype_identifier LEFT_RIGHT
784 { expand_member_init (current_class_ref, $1, void_type_node); }
785 | complete_type_name '(' nonnull_exprlist ')'
786 { expand_member_init (current_class_ref, $1, $3); }
787 | complete_type_name LEFT_RIGHT
788 { expand_member_init (current_class_ref, $1, void_type_node); }
790 | notype_qualified_id '(' nonnull_exprlist ')'
792 do_member_init (OP0 ($1), OP1 ($1), $3);
794 | notype_qualified_id LEFT_RIGHT
796 do_member_init (OP0 ($1), OP1 ($1), void_type_node);
820 explicit_instantiation:
821 TEMPLATE aggr template_type
822 { do_type_instantiation ($3, NULL_TREE); }
823 | TEMPLATE typed_declspecs declarator
824 { tree specs = strip_attrs ($2.t);
825 do_decl_instantiation (specs, $3, NULL_TREE); }
826 | TEMPLATE notype_declarator
827 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
828 | TEMPLATE constructor_declarator
829 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
830 | SCSPEC TEMPLATE aggr template_type
831 { do_type_instantiation ($4, $1); }
832 | SCSPEC TEMPLATE typed_declspecs declarator
833 { tree specs = strip_attrs ($3.t);
834 do_decl_instantiation (specs, $4, $1); }
835 | SCSPEC TEMPLATE notype_declarator
836 { do_decl_instantiation (NULL_TREE, $3, $1); }
837 | SCSPEC TEMPLATE constructor_declarator
838 { do_decl_instantiation (NULL_TREE, $3, $1); }
841 /* The TYPENAME expansions are to deal with use of a template class name as
842 a template within the class itself, where the template decl is hidden by
843 a type decl. Got all that? */
846 PTYPENAME '<' template_arg_list template_close_bracket
848 $$ = lookup_template_class ($1, $3, NULL_TREE);
849 if ($$ != error_mark_node)
850 $$ = TYPE_STUB_DECL ($$);
852 | PTYPENAME '<' template_close_bracket
854 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
855 if ($$ != error_mark_node)
856 $$ = TYPE_STUB_DECL ($$);
858 | TYPENAME '<' template_arg_list template_close_bracket
860 $$ = lookup_template_class ($1, $3, NULL_TREE);
861 if ($$ != error_mark_node)
862 $$ = TYPE_STUB_DECL ($$);
864 | TYPENAME '<' template_close_bracket
866 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
867 if ($$ != error_mark_node)
868 $$ = TYPE_STUB_DECL ($$);
874 SELFNAME '<' template_arg_list template_close_bracket
876 $$ = lookup_template_class ($1, $3, NULL_TREE);
877 if ($$ != error_mark_node)
878 $$ = TYPE_STUB_DECL ($$);
880 | SELFNAME '<' template_close_bracket
882 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
883 if ($$ != error_mark_node)
884 $$ = TYPE_STUB_DECL ($$);
888 template_close_bracket:
892 /* Handle `Class<Class<Type>>' without space in the `>>' */
893 pedwarn ("`>>' should be `> >' in template class name");
900 { $$ = build_tree_list (NULL_TREE, $$); }
901 | template_arg_list ',' template_arg
902 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
907 { $$ = groktypename ($1.t); }
908 | expr_no_commas %prec ARITHCOMPARE
913 { $$ = NEGATE_EXPR; }
915 { $$ = CONVERT_EXPR; }
917 { $$ = PREINCREMENT_EXPR; }
919 { $$ = PREDECREMENT_EXPR; }
921 { $$ = TRUTH_NOT_EXPR; }
926 { $$ = build_x_compound_expr ($$); }
932 { error ("ANSI C++ forbids an empty condition for `%s'",
934 $$ = integer_zero_node; }
936 { $$ = condition_conversion ($2); }
941 { error ("ANSI C++ forbids an empty condition for `%s'",
943 $$ = integer_zero_node; }
945 { $$ = condition_conversion ($2); }
952 { $$ = condition_conversion ($$); }
958 type_specifier_seq declarator maybeasm maybe_attribute '='
961 for (d = getdecls (); d; d = TREE_CHAIN (d))
962 if (TREE_CODE (d) == TYPE_DECL) {
963 tree s = TREE_TYPE (d);
964 if (TREE_CODE (s) == RECORD_TYPE)
965 cp_error ("definition of class `%T' in condition", s);
966 else if (TREE_CODE (s) == ENUMERAL_TYPE)
967 cp_error ("definition of enum `%T' in condition", s);
970 current_declspecs = $1.t;
971 $<itype>5 = suspend_momentary ();
972 $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1);
973 cplus_decl_attributes ($<ttype>$, $4,
974 /*prefix_attributes*/ NULL_TREE);
978 cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
979 resume_momentary ($<itype>5);
981 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
982 cp_error ("definition of array `%#D' in condition", $$);
989 | maybe_label_decls stmts '}'
990 | maybe_label_decls stmts error '}'
991 | maybe_label_decls error '}'
997 if (processing_template_decl)
999 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
1000 COMPOUND_STMT_NO_SCOPE ($<ttype>$) = 1;
1001 add_tree ($<ttype>$);
1006 if (processing_template_decl)
1008 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
1009 TREE_CHAIN ($<ttype>2) = NULL_TREE;
1010 last_tree = $<ttype>2;
1018 nontrivial_exprlist:
1019 expr_no_commas ',' expr_no_commas
1020 { $$ = tree_cons (NULL_TREE, $$,
1021 build_tree_list (NULL_TREE, $3)); }
1022 | expr_no_commas ',' error
1023 { $$ = tree_cons (NULL_TREE, $$,
1024 build_tree_list (NULL_TREE, error_mark_node)); }
1025 | nontrivial_exprlist ',' expr_no_commas
1026 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1027 | nontrivial_exprlist ',' error
1028 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1033 { $$ = build_tree_list (NULL_TREE, $$); }
1034 | nontrivial_exprlist
1040 /* __extension__ turns off -pedantic for following primary. */
1041 | extension cast_expr %prec UNARY
1043 pedantic = $<itype>1; }
1044 | '*' cast_expr %prec UNARY
1045 { $$ = build_x_indirect_ref ($2, "unary *"); }
1046 | '&' cast_expr %prec UNARY
1047 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1049 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1050 | unop cast_expr %prec UNARY
1051 { $$ = build_x_unary_op ($1, $2);
1052 if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
1053 TREE_NEGATED_INT ($$) = 1;
1054 overflow_warning ($$);
1056 /* Refer to the address of a label as a pointer. */
1058 { tree label = lookup_label ($2);
1059 if (label == NULL_TREE)
1060 $$ = null_pointer_node;
1063 TREE_USED (label) = 1;
1064 $$ = build1 (ADDR_EXPR, ptr_type_node, label);
1065 TREE_CONSTANT ($$) = 1;
1068 | SIZEOF unary_expr %prec UNARY
1069 { $$ = expr_sizeof ($2); }
1070 | SIZEOF '(' type_id ')' %prec HYPERUNARY
1071 { $$ = c_sizeof (groktypename ($3.t)); }
1072 | ALIGNOF unary_expr %prec UNARY
1073 { $$ = grok_alignof ($2); }
1074 | ALIGNOF '(' type_id ')' %prec HYPERUNARY
1075 { $$ = c_alignof (groktypename ($3.t));
1076 check_for_new_type ("alignof", $3); }
1078 /* The %prec EMPTY's here are required by the = init initializer
1079 syntax extension; see below. */
1080 | new new_type_id %prec EMPTY
1081 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1082 check_for_new_type ("new", $2); }
1083 | new new_type_id new_initializer
1084 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1085 check_for_new_type ("new", $2); }
1086 | new new_placement new_type_id %prec EMPTY
1087 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1088 check_for_new_type ("new", $3); }
1089 | new new_placement new_type_id new_initializer
1090 { $$ = build_new ($2, $3.t, $4, $1);
1091 check_for_new_type ("new", $3); }
1092 | new '(' type_id ')' %prec EMPTY
1093 { $$ = build_new (NULL_TREE, groktypename($3.t),
1095 check_for_new_type ("new", $3); }
1096 | new '(' type_id ')' new_initializer
1097 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1098 check_for_new_type ("new", $3); }
1099 | new new_placement '(' type_id ')' %prec EMPTY
1100 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1101 check_for_new_type ("new", $4); }
1102 | new new_placement '(' type_id ')' new_initializer
1103 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1104 check_for_new_type ("new", $4); }
1106 | delete cast_expr %prec UNARY
1107 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1108 | delete '[' ']' cast_expr %prec UNARY
1109 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1110 if (yychar == YYEMPTY)
1112 | delete '[' expr ']' cast_expr %prec UNARY
1113 { $$ = delete_sanity ($5, $3, 2, $1);
1114 if (yychar == YYEMPTY)
1116 | REALPART cast_expr %prec UNARY
1117 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1118 | IMAGPART cast_expr %prec UNARY
1119 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1123 '(' nonnull_exprlist ')'
1125 | '{' nonnull_exprlist '}'
1128 pedwarn ("old style placement syntax, use () instead");
1133 '(' nonnull_exprlist ')'
1139 cp_error ("`%T' is not a valid expression", $2.t);
1140 $$ = error_mark_node;
1142 /* GNU extension so people can use initializer lists. Note that
1143 this alters the meaning of `new int = 1', which was previously
1144 syntactically valid but semantically invalid. */
1148 pedwarn ("ANSI C++ forbids initialization of new expression with `='");
1153 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1155 '(' type_id ')' %prec EMPTY
1156 { $2.t = tree_cons (NULL_TREE, $2.t, void_list_node);
1157 TREE_PARMLIST ($2.t) = 1;
1158 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1159 check_for_new_type ("cast", $2); }
1160 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1161 { $3.t = tree_cons (NULL_TREE, $3.t, void_list_node);
1162 TREE_PARMLIST ($3.t) = 1;
1163 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1164 check_for_new_type ("cast", $3); }
1169 | regcast_or_absdcl unary_expr %prec UNARY
1170 { $$ = reparse_absdcl_as_casts ($$, $2); }
1171 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1173 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1176 pedwarn ("ANSI C++ forbids constructor-expressions");
1177 /* Indicate that this was a GNU C constructor expression. */
1178 TREE_HAS_CONSTRUCTOR (init) = 1;
1180 $$ = reparse_absdcl_as_casts ($$, init);
1186 /* Handle general members. */
1187 | expr_no_commas POINTSAT_STAR expr_no_commas
1188 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1189 | expr_no_commas DOT_STAR expr_no_commas
1190 { $$ = build_m_component_ref ($$, $3); }
1191 | expr_no_commas '+' expr_no_commas
1192 { $$ = build_x_binary_op ($2, $$, $3); }
1193 | expr_no_commas '-' expr_no_commas
1194 { $$ = build_x_binary_op ($2, $$, $3); }
1195 | expr_no_commas '*' expr_no_commas
1196 { $$ = build_x_binary_op ($2, $$, $3); }
1197 | expr_no_commas '/' expr_no_commas
1198 { $$ = build_x_binary_op ($2, $$, $3); }
1199 | expr_no_commas '%' expr_no_commas
1200 { $$ = build_x_binary_op ($2, $$, $3); }
1201 | expr_no_commas LSHIFT expr_no_commas
1202 { $$ = build_x_binary_op ($2, $$, $3); }
1203 | expr_no_commas RSHIFT expr_no_commas
1204 { $$ = build_x_binary_op ($2, $$, $3); }
1205 | expr_no_commas ARITHCOMPARE expr_no_commas
1206 { $$ = build_x_binary_op ($2, $$, $3); }
1207 | expr_no_commas '<' expr_no_commas
1208 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1209 | expr_no_commas '>' expr_no_commas
1210 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1211 | expr_no_commas EQCOMPARE expr_no_commas
1212 { $$ = build_x_binary_op ($2, $$, $3); }
1213 | expr_no_commas MIN_MAX expr_no_commas
1214 { $$ = build_x_binary_op ($2, $$, $3); }
1215 | expr_no_commas '&' expr_no_commas
1216 { $$ = build_x_binary_op ($2, $$, $3); }
1217 | expr_no_commas '|' expr_no_commas
1218 { $$ = build_x_binary_op ($2, $$, $3); }
1219 | expr_no_commas '^' expr_no_commas
1220 { $$ = build_x_binary_op ($2, $$, $3); }
1221 | expr_no_commas ANDAND expr_no_commas
1222 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1223 | expr_no_commas OROR expr_no_commas
1224 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1225 | expr_no_commas '?' xexpr ':' expr_no_commas
1226 { $$ = build_x_conditional_expr ($$, $3, $5); }
1227 | expr_no_commas '=' expr_no_commas
1228 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1229 if ($$ != error_mark_node)
1230 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1231 | expr_no_commas ASSIGN expr_no_commas
1232 { $$ = build_x_modify_expr ($$, $2, $3); }
1234 { $$ = build_throw (NULL_TREE); }
1235 | THROW expr_no_commas
1236 { $$ = build_throw ($2); }
1237 /* These extensions are not defined. The second arg to build_m_component_ref
1238 is old, build_m_component_ref now does an implicit
1239 build_indirect_ref (x, NULL_PTR) on the second argument.
1240 | object '&' expr_no_commas %prec UNARY
1241 { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
1242 | object unop expr_no_commas %prec UNARY
1243 { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
1244 | object '(' type_id ')' expr_no_commas %prec UNARY
1245 { tree type = groktypename ($3.t);
1246 $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
1247 | object primary_no_id %prec UNARY
1248 { $$ = build_m_component_ref ($$, $2); }
1252 notype_unqualified_id:
1253 '~' see_typename identifier
1254 { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
1258 | NSNAME %prec EMPTY
1262 notype_unqualified_id
1268 notype_unqualified_id
1269 | '*' expr_or_declarator %prec UNARY
1270 { $$ = build_parse_node (INDIRECT_REF, $2); }
1271 | '&' expr_or_declarator %prec UNARY
1272 { $$ = build_parse_node (ADDR_EXPR, $2); }
1273 | '(' expr_or_declarator ')'
1277 direct_notype_declarator:
1278 complex_direct_notype_declarator
1279 | notype_unqualified_id
1280 | '(' expr_or_declarator ')'
1281 { $$ = finish_decl_parsing ($2); }
1285 notype_unqualified_id
1287 if (TREE_CODE ($$) == BIT_NOT_EXPR)
1288 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
1290 $$ = do_identifier ($$, 1);
1296 if (processing_template_decl)
1297 push_obstacks (&permanent_obstack, &permanent_obstack);
1298 $$ = combine_strings ($$);
1299 if (processing_template_decl)
1305 class = TREE_CODE_CLASS (TREE_CODE ($$));
1306 if (class == 'e' || class == '1'
1307 || class == '2' || class == '<')
1308 /* This inhibits warnings in truthvalue_conversion. */
1309 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1310 | '(' expr_or_declarator ')'
1312 $$ = reparse_decl_as_expr (NULL_TREE, $2);
1313 class = TREE_CODE_CLASS (TREE_CODE ($$));
1314 if (class == 'e' || class == '1'
1315 || class == '2' || class == '<')
1316 /* This inhibits warnings in truthvalue_conversion. */
1317 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1319 { $$ = error_mark_node; }
1321 { if (current_function_decl == 0)
1323 error ("braced-group within expression allowed only inside a function");
1327 $<ttype>$ = expand_start_stmt_expr (); }
1331 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1332 rtl_exp = expand_end_stmt_expr ($<ttype>2);
1333 /* The statements have side effects, so the group does. */
1334 TREE_SIDE_EFFECTS (rtl_exp) = 1;
1336 if (TREE_CODE ($3) == BLOCK)
1338 /* Make a BIND_EXPR for the BLOCK already made. */
1339 $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
1340 NULL_TREE, rtl_exp, $3);
1341 /* Remove the block from the tree at this point.
1342 It gets put back at the proper place
1343 when the BIND_EXPR is expanded. */
1349 | primary '(' nonnull_exprlist ')'
1351 $$ = build_x_function_call ($1, $3, current_class_ref);
1352 if (TREE_CODE ($$) == CALL_EXPR
1353 && TREE_TYPE ($$) != void_type_node)
1354 $$ = require_complete_type ($$);
1356 | primary LEFT_RIGHT
1358 $$ = build_x_function_call ($$, NULL_TREE, current_class_ref);
1359 if (TREE_CODE ($$) == CALL_EXPR
1360 && TREE_TYPE ($$) != void_type_node)
1361 $$ = require_complete_type ($$);
1363 | primary '[' expr ']'
1364 { $$ = grok_array_decl ($$, $3); }
1366 { /* If we get an OFFSET_REF, turn it into what it really
1367 means (e.g., a COMPONENT_REF). This way if we've got,
1368 say, a reference to a static member that's being operated
1369 on, we don't end up trying to find a member operator for
1370 the class it's in. */
1371 if (TREE_CODE ($$) == OFFSET_REF)
1372 $$ = resolve_offset_ref ($$);
1373 $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1374 | primary MINUSMINUS
1375 { if (TREE_CODE ($$) == OFFSET_REF)
1376 $$ = resolve_offset_ref ($$);
1377 $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1378 /* C++ extensions */
1380 { if (current_class_ptr)
1382 #ifdef WARNING_ABOUT_CCD
1383 TREE_USED (current_class_ptr) = 1;
1385 $$ = current_class_ptr;
1387 else if (current_function_decl
1388 && DECL_STATIC_FUNCTION_P (current_function_decl))
1390 error ("`this' is unavailable for static member functions");
1391 $$ = error_mark_node;
1395 if (current_function_decl)
1396 error ("invalid use of `this' in non-member function");
1398 error ("invalid use of `this' at top level");
1399 $$ = error_mark_node;
1402 | CV_QUALIFIER '(' nonnull_exprlist ')'
1407 /* This is a C cast in C++'s `functional' notation. */
1408 if ($3 == error_mark_node)
1410 $$ = error_mark_node;
1414 if ($3 == NULL_TREE)
1416 error ("cannot cast null list to type `%s'",
1417 IDENTIFIER_POINTER (TYPE_NAME (id)));
1418 $$ = error_mark_node;
1423 /* type is not set! (mrs) */
1424 if (type == error_mark_node)
1425 $$ = error_mark_node;
1429 if (id == ridpointers[(int) RID_CONST])
1430 type = build_type_variant (integer_type_node, 1, 0);
1431 else if (id == ridpointers[(int) RID_VOLATILE])
1432 type = build_type_variant (integer_type_node, 0, 1);
1434 /* should not be able to get here (mrs) */
1435 else if (id == ridpointers[(int) RID_FRIEND])
1437 error ("cannot cast expression to `friend' type");
1438 $$ = error_mark_node;
1442 else my_friendly_abort (79);
1443 $$ = build_c_cast (type, build_compound_expr ($3));
1447 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1448 { tree type = groktypename ($3.t);
1449 check_for_new_type ("dynamic_cast", $3);
1450 $$ = build_dynamic_cast (type, $6); }
1451 | STATIC_CAST '<' type_id '>' '(' expr ')'
1452 { tree type = groktypename ($3.t);
1453 check_for_new_type ("static_cast", $3);
1454 $$ = build_static_cast (type, $6); }
1455 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1456 { tree type = groktypename ($3.t);
1457 check_for_new_type ("reinterpret_cast", $3);
1458 $$ = build_reinterpret_cast (type, $6); }
1459 | CONST_CAST '<' type_id '>' '(' expr ')'
1460 { tree type = groktypename ($3.t);
1461 check_for_new_type ("const_cast", $3);
1462 $$ = build_const_cast (type, $6); }
1463 | TYPEID '(' expr ')'
1464 { $$ = build_x_typeid ($3); }
1465 | TYPEID '(' type_id ')'
1466 { tree type = groktypename ($3.t);
1467 check_for_new_type ("typeid", $3);
1468 $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
1469 | global_scope IDENTIFIER
1470 { $$ = do_scoped_id ($2, 1); }
1471 | global_scope operator_name
1473 got_scope = NULL_TREE;
1474 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1475 $$ = do_scoped_id ($2, 1);
1479 | overqualified_id %prec HYPERUNARY
1480 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1481 | overqualified_id '(' nonnull_exprlist ')'
1482 { if (processing_template_decl)
1483 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, NULL_TREE);
1485 $$ = build_member_call (OP0 ($$), OP1 ($$), $3); }
1486 | overqualified_id LEFT_RIGHT
1487 { if (processing_template_decl)
1488 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1),
1489 NULL_TREE, NULL_TREE);
1491 $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); }
1492 | object unqualified_id %prec UNARY
1493 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1494 | object overqualified_id %prec UNARY
1495 { if (processing_template_decl)
1496 $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
1498 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1499 | object unqualified_id '(' nonnull_exprlist ')'
1502 /* This is a future direction of this code, but because
1503 build_x_function_call cannot always undo what is done
1504 in build_component_ref entirely yet, we cannot do this. */
1505 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, current_class_ref);
1506 if (TREE_CODE ($$) == CALL_EXPR
1507 && TREE_TYPE ($$) != void_type_node)
1508 $$ = require_complete_type ($$);
1510 $$ = build_method_call ($$, $2, $4, NULL_TREE,
1514 | object unqualified_id LEFT_RIGHT
1517 /* This is a future direction of this code, but because
1518 build_x_function_call cannot always undo what is done
1519 in build_component_ref entirely yet, we cannot do this. */
1520 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, current_class_ref);
1521 if (TREE_CODE ($$) == CALL_EXPR
1522 && TREE_TYPE ($$) != void_type_node)
1523 $$ = require_complete_type ($$);
1525 $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
1529 | object overqualified_id '(' nonnull_exprlist ')'
1531 if (IS_SIGNATURE (OP0 ($2)))
1533 warning ("signature name in scope resolution ignored");
1534 $$ = build_method_call ($$, OP1 ($2), $4, NULL_TREE,
1538 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
1540 | object overqualified_id LEFT_RIGHT
1542 if (IS_SIGNATURE (OP0 ($2)))
1544 warning ("signature name in scope resolution ignored");
1545 $$ = build_method_call ($$, OP1 ($2), NULL_TREE, NULL_TREE,
1549 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), NULL_TREE);
1551 /* p->int::~int() is valid -- 12.4 */
1552 | object '~' TYPESPEC LEFT_RIGHT
1554 if (IDENTIFIER_GLOBAL_VALUE ($3)
1555 && (TREE_CODE (TREE_TYPE ($1))
1556 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
1557 cp_error ("`%E' is not of type `%T'", $1, $3);
1558 $$ = cp_convert (void_type_node, $1);
1560 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1563 cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
1564 if (TREE_CODE (TREE_TYPE ($1))
1565 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
1566 cp_error ("`%E' is not of type `%T'", $1, $2);
1567 $$ = cp_convert (void_type_node, $1);
1571 $$ = error_mark_node;
1575 /* Not needed for now.
1581 { $$ = error_mark_node; }
1583 { if (current_function_decl == 0)
1585 error ("braced-group within expression allowed only inside a function");
1588 $<ttype>$ = expand_start_stmt_expr (); }
1591 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1592 $$ = expand_end_stmt_expr ($<ttype>2); }
1593 | primary_no_id '(' nonnull_exprlist ')'
1594 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1595 | primary_no_id LEFT_RIGHT
1596 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1597 | primary_no_id '[' expr ']'
1599 | primary_no_id PLUSPLUS
1600 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1601 | primary_no_id MINUSMINUS
1602 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1604 { goto do_scoped_id; }
1605 | SCOPE operator_name
1606 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1608 goto do_scoped_operator;
1617 { got_scope = NULL_TREE; $$ = 1; }
1623 | global_scope delete
1624 { got_scope = NULL_TREE; $$ = 1; }
1629 { $$ = boolean_true_node; }
1631 { $$ = boolean_false_node; }
1634 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1638 { $$ = chainon ($$, $2); }
1644 if (! current_function_parms_stored)
1645 store_parm_decls ();
1647 /* Always keep the BLOCK node associated with the outermost
1648 pair of curley braces of a function. These are needed
1649 for correct operation of dwarfout.c. */
1656 { got_object = TREE_TYPE ($$); }
1659 $$ = build_x_arrow ($$);
1660 got_object = TREE_TYPE ($$);
1665 typespec initdecls ';'
1667 resume_momentary ($2);
1668 if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1669 note_got_semicolon ($1.t);
1671 | typed_declspecs initdecls ';'
1673 resume_momentary ($2);
1674 note_list_got_semicolon ($1.t);
1676 | declmods notype_initdecls ';'
1677 { resume_momentary ($2); }
1678 | typed_declspecs ';'
1681 note_list_got_semicolon ($1.t);
1684 { warning ("empty declaration"); }
1686 { pedantic = $<itype>1; }
1689 /* Any kind of declarator (thus, all declarators allowed
1690 after an explicit typespec). */
1693 after_type_declarator %prec EMPTY
1694 | notype_declarator %prec EMPTY
1697 /* This is necessary to postpone reduction of `int()()()()'. */
1699 LEFT_RIGHT %prec EMPTY
1700 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1701 NULL_TREE, NULL_TREE); }
1702 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1703 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1707 /* ANSI type-id (8.1) */
1709 typed_typespecs absdcl
1710 { $$.t = build_decl_list ($1.t, $2);
1711 $$.new_type_flag = $1.new_type_flag; }
1712 | nonempty_cv_qualifiers absdcl
1713 { $$.t = build_decl_list ($1.t, $2);
1714 $$.new_type_flag = $1.new_type_flag; }
1716 { $$.t = build_decl_list (get_decl_list ($1.t), $2);
1717 $$.new_type_flag = $1.new_type_flag; }
1718 | typed_typespecs %prec EMPTY
1719 { $$.t = build_decl_list ($1.t, NULL_TREE);
1720 $$.new_type_flag = $1.new_type_flag; }
1721 | nonempty_cv_qualifiers %prec EMPTY
1722 { $$.t = build_decl_list ($1.t, NULL_TREE);
1723 $$.new_type_flag = $1.new_type_flag; }
1726 /* Declspecs which contain at least one type specifier or typedef name.
1727 (Just `const' or `volatile' is not enough.)
1728 A typedef'd name following these is taken as a name to be declared.
1729 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1732 typed_typespecs %prec EMPTY
1738 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1);
1739 $$.new_type_flag = $2.new_type_flag; }
1740 | typespec reserved_declspecs %prec HYPERUNARY
1741 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1742 $$.new_type_flag = $1.new_type_flag; }
1743 | typespec reserved_typespecquals reserved_declspecs
1744 { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1745 $$.new_type_flag = $1.new_type_flag; }
1746 | declmods typespec reserved_declspecs
1747 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1748 $$.new_type_flag = $2.new_type_flag; }
1749 | declmods typespec reserved_typespecquals
1750 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1751 $$.new_type_flag = $2.new_type_flag; }
1752 | declmods typespec reserved_typespecquals reserved_declspecs
1753 { $$.t = decl_tree_cons (NULL_TREE, $2.t,
1754 chainon ($3, chainon ($4, $1)));
1755 $$.new_type_flag = $2.new_type_flag; }
1760 { if (extra_warnings)
1761 warning ("`%s' is not at beginning of declaration",
1762 IDENTIFIER_POINTER ($$));
1763 $$ = build_decl_list (NULL_TREE, $$); }
1764 | reserved_declspecs typespecqual_reserved
1765 { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
1766 | reserved_declspecs SCSPEC
1767 { if (extra_warnings)
1768 warning ("`%s' is not at beginning of declaration",
1769 IDENTIFIER_POINTER ($2));
1770 $$ = decl_tree_cons (NULL_TREE, $2, $$); }
1771 | reserved_declspecs attributes
1772 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1774 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1777 /* List of just storage classes and type modifiers.
1778 A declaration can start with just this, but then it cannot be used
1779 to redeclare a typedef-name.
1780 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1783 nonempty_cv_qualifiers %prec EMPTY
1784 { $$ = $1.t; TREE_STATIC ($$) = 1; }
1786 { $$ = IDENTIFIER_AS_LIST ($$); }
1787 | declmods CV_QUALIFIER
1788 { $$ = decl_tree_cons (NULL_TREE, $2, $$);
1789 TREE_STATIC ($$) = 1; }
1791 { if (extra_warnings && TREE_STATIC ($$))
1792 warning ("`%s' is not at beginning of declaration",
1793 IDENTIFIER_POINTER ($2));
1794 $$ = decl_tree_cons (NULL_TREE, $2, $$);
1795 TREE_STATIC ($$) = TREE_STATIC ($1); }
1796 | declmods attributes
1797 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1799 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1802 /* Used instead of declspecs where storage classes are not allowed
1803 (that is, for typenames and structure components).
1805 C++ can takes storage classes for structure components.
1806 Don't accept a typedef-name if anything but a modifier precedes it. */
1809 typespec %prec EMPTY
1810 { $$.t = get_decl_list ($1.t);
1811 $$.new_type_flag = $1.new_type_flag; }
1812 | nonempty_cv_qualifiers typespec
1813 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
1814 $$.new_type_flag = $2.new_type_flag; }
1815 | typespec reserved_typespecquals
1816 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1817 $$.new_type_flag = $1.new_type_flag; }
1818 | nonempty_cv_qualifiers typespec reserved_typespecquals
1819 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1820 $$.new_type_flag = $1.new_type_flag; }
1823 reserved_typespecquals:
1824 typespecqual_reserved
1825 { $$ = build_decl_list (NULL_TREE, $1.t); }
1826 | reserved_typespecquals typespecqual_reserved
1827 { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
1830 /* A typespec (but not a type qualifier).
1831 Once we have seen one of these in a declaration,
1832 if a typedef name appears then it is being redeclared. */
1836 | TYPESPEC %prec EMPTY
1837 { $$.t = $1; $$.new_type_flag = 0; }
1838 | complete_type_name
1839 { $$.t = $1; $$.new_type_flag = 0; }
1840 | TYPEOF '(' expr ')'
1841 { $$.t = TREE_TYPE ($3);
1842 $$.new_type_flag = 0; }
1843 | TYPEOF '(' type_id ')'
1844 { $$.t = groktypename ($3.t);
1845 $$.new_type_flag = 0; }
1846 | SIGOF '(' expr ')'
1847 { tree type = TREE_TYPE ($3);
1849 $$.new_type_flag = 0;
1850 if (IS_AGGR_TYPE (type))
1852 sorry ("sigof type specifier");
1857 error ("`sigof' applied to non-aggregate expression");
1858 $$.t = error_mark_node;
1861 | SIGOF '(' type_id ')'
1862 { tree type = groktypename ($3.t);
1864 $$.new_type_flag = 0;
1865 if (IS_AGGR_TYPE (type))
1867 sorry ("sigof type specifier");
1872 error("`sigof' applied to non-aggregate type");
1873 $$.t = error_mark_node;
1878 /* A typespec that is a reserved word, or a type qualifier. */
1880 typespecqual_reserved:
1882 { $$.t = $1; $$.new_type_flag = 0; }
1884 { $$.t = $1; $$.new_type_flag = 0; }
1890 | initdecls ',' initdcl
1895 | notype_initdecls ',' initdcl
1900 | nomods_initdecls ',' initdcl
1906 | asm_keyword '(' string ')'
1907 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
1911 declarator maybeasm maybe_attribute '='
1912 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1913 &prefix_attributes);
1914 if (current_declspecs
1915 && TREE_CODE (current_declspecs) != TREE_LIST)
1916 current_declspecs = get_decl_list (current_declspecs);
1917 if (have_extern_spec && !used_extern_spec)
1919 current_declspecs = decl_tree_cons
1920 (NULL_TREE, get_identifier ("extern"),
1922 used_extern_spec = 1;
1924 $<itype>4 = suspend_momentary ();
1925 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1926 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1928 /* Note how the declaration of the variable is in effect while its init is parsed! */
1929 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1931 | declarator maybeasm maybe_attribute
1933 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1934 &prefix_attributes);
1935 if (current_declspecs
1936 && TREE_CODE (current_declspecs) != TREE_LIST)
1937 current_declspecs = get_decl_list (current_declspecs);
1938 if (have_extern_spec && !used_extern_spec)
1940 current_declspecs = decl_tree_cons
1941 (NULL_TREE, get_identifier ("extern"),
1943 used_extern_spec = 1;
1945 $$ = suspend_momentary ();
1946 d = start_decl ($<ttype>1, current_declspecs, 0);
1947 cplus_decl_attributes (d, $3, prefix_attributes);
1948 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1952 declarator maybeasm maybe_attribute '='
1953 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1954 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1956 /* Note how the declaration of the variable is in effect while its init is parsed! */
1957 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING); }
1958 | declarator maybeasm maybe_attribute
1959 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0);
1960 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes);
1961 cp_finish_decl ($<ttype>$, NULL_TREE, $2, 1, 0); }
1965 notype_declarator maybeasm maybe_attribute '='
1966 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1967 &prefix_attributes);
1968 $<itype>4 = suspend_momentary ();
1969 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1970 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1972 /* Note how the declaration of the variable is in effect while its init is parsed! */
1973 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1975 | notype_declarator maybeasm maybe_attribute
1977 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1978 &prefix_attributes);
1979 $$ = suspend_momentary ();
1980 d = start_decl ($<ttype>1, current_declspecs, 0);
1981 cplus_decl_attributes (d, $3, prefix_attributes);
1982 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1986 notype_declarator maybeasm maybe_attribute '='
1987 { current_declspecs = NULL_TREE;
1988 prefix_attributes = NULL_TREE;
1989 $<itype>4 = suspend_momentary ();
1990 $<ttype>$ = start_decl ($1, current_declspecs, 1);
1991 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1993 /* Note how the declaration of the variable is in effect while its init is parsed! */
1994 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1996 | notype_declarator maybeasm maybe_attribute
1998 current_declspecs = NULL_TREE;
1999 prefix_attributes = NULL_TREE;
2000 $$ = suspend_momentary ();
2001 d = start_decl ($1, current_declspecs, 0);
2002 cplus_decl_attributes (d, $3, prefix_attributes);
2003 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
2006 /* the * rules are dummies to accept the Apollo extended syntax
2007 so that the header files compile. */
2018 | attributes attribute
2019 { $$ = chainon ($1, $2); }
2023 ATTRIBUTE '(' '(' attribute_list ')' ')'
2030 | attribute_list ',' attrib
2031 { $$ = chainon ($1, $3); }
2038 { $$ = build_tree_list ($1, NULL_TREE); }
2039 | any_word '(' IDENTIFIER ')'
2040 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2041 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2042 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2043 | any_word '(' nonnull_exprlist ')'
2044 { $$ = build_tree_list ($1, $3); }
2047 /* This still leaves out most reserved keywords,
2048 shouldn't we include them? */
2057 /* A nonempty list of identifiers, including typenames. */
2058 identifiers_or_typenames:
2060 { $$ = build_tree_list (NULL_TREE, $1); }
2061 | identifiers_or_typenames ',' identifier
2062 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2066 /* empty */ %prec EMPTY
2071 /* If we are processing a template, we don't want to expand this
2075 expr_no_commas %prec '='
2077 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2078 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2080 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2081 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2082 | '{' initlist ',' '}'
2083 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2084 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2089 /* This chain is built in reverse order,
2090 and put in forward order where initlist is used. */
2093 { $$ = build_tree_list (NULL_TREE, $$); }
2095 { $$ = tree_cons (NULL_TREE, $3, $$); }
2096 /* These are for labeled elements. */
2097 | '[' expr_no_commas ']' init
2098 { $$ = build_tree_list ($2, $4); }
2099 | initlist ',' CASE expr_no_commas ':' init
2100 { $$ = tree_cons ($4, $6, $$); }
2101 | identifier ':' init
2102 { $$ = build_tree_list ($$, $3); }
2103 | initlist ',' identifier ':' init
2104 { $$ = tree_cons ($3, $5, $$); }
2108 PRE_PARSED_FUNCTION_DECL
2109 { start_function (NULL_TREE, TREE_VALUE ($1),
2111 reinit_parse_for_function (); }
2114 fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
2116 int nested = (hack_decl_function_context
2117 (current_function_decl) != NULL_TREE);
2118 finish_function (lineno, (int)$3, nested);
2119 process_next_inline ($1);
2121 | fn.defpen maybe_return_init function_try_block
2122 { process_next_inline ($1); }
2123 | fn.defpen maybe_return_init error
2124 { process_next_inline ($1); }
2129 | pending_inlines pending_inline eat_saved_input
2132 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2133 the TREE_LIST node for the parameter in question. */
2135 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2136 { replace_defarg ($1, $2); }
2137 | DEFARG_MARKER error END_OF_SAVED_INPUT
2138 { replace_defarg ($1, error_mark_node); }
2141 /* empty */ %prec EMPTY
2142 | pending_defargs defarg_again
2143 { do_pending_defargs (); }
2144 | pending_defargs error
2145 { do_pending_defargs (); }
2150 { $<itype>3 = suspend_momentary ();
2151 $<ttype>$ = start_enum ($2); }
2152 enumlist maybecomma_warn '}'
2153 { $$.t = finish_enum ($<ttype>4, $5);
2154 $$.new_type_flag = 1;
2155 resume_momentary ((int) $<itype>3);
2156 check_for_missing_semicolon ($<ttype>4); }
2157 | ENUM identifier '{' '}'
2158 { $$.t = finish_enum (start_enum ($2), NULL_TREE);
2159 $$.new_type_flag = 1;
2160 check_for_missing_semicolon ($$.t); }
2162 { $<itype>2 = suspend_momentary ();
2163 $<ttype>$ = start_enum (make_anon_name ()); }
2164 enumlist maybecomma_warn '}'
2165 { $$.t = finish_enum ($<ttype>3, $4);
2166 resume_momentary ((int) $<itype>1);
2167 check_for_missing_semicolon ($<ttype>3);
2168 $$.new_type_flag = 1; }
2170 { $$.t = finish_enum (start_enum (make_anon_name()), NULL_TREE);
2171 $$.new_type_flag = 1;
2172 check_for_missing_semicolon ($$.t); }
2174 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2175 $$.new_type_flag = 0; }
2176 | ENUM complex_type_name
2177 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2178 $$.new_type_flag = 0; }
2179 | TYPENAME_KEYWORD nested_name_specifier identifier
2180 { $$.t = make_typename_type ($2, $3);
2181 $$.new_type_flag = 0; }
2182 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2183 { $$.t = make_typename_type ($3, $4);
2184 $$.new_type_flag = 0; }
2185 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2186 | class_head left_curly opt.component_decl_list '}' maybe_attribute
2193 /* Need to rework class nesting in the
2194 presence of nested classes, etc. */
2195 shadow_tag (CLASSTYPE_AS_LIST ($1)); */
2197 if (yychar == YYEMPTY)
2199 semi = yychar == ';';
2200 /* finish_struct nukes this anyway; if
2201 finish_exception does too, then it can go. */
2203 note_got_semicolon ($1);
2205 if (TREE_CODE ($1) == ENUMERAL_TYPE)
2209 $<ttype>$ = finish_struct ($1, $3, $5, semi);
2210 if (semi) note_got_semicolon ($<ttype>$);
2216 check_for_missing_semicolon ($1);
2217 if (current_scope () == current_function_decl)
2218 do_pending_defargs ($1);
2223 && current_scope () == current_function_decl)
2224 do_pending_inlines ();
2229 $$.new_type_flag = 1;
2230 if (current_scope () == current_function_decl)
2231 clear_inline_text_obstack ();
2233 | class_head %prec EMPTY
2236 $$.new_type_flag = 0;
2237 /* struct B: public A; is not accepted by the WP grammar. */
2238 if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
2239 && ! TYPE_BEING_DEFINED ($$.t))
2240 cp_error ("base clause without member specification for `%#T'",
2253 { if (pedantic && !in_system_header)
2254 pedwarn ("comma at end of enumerator list"); }
2260 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2262 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2264 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2266 { error ("no body nor ';' separates two class, struct or union declarations"); }
2269 named_class_head_sans_basetype:
2271 { current_aggr = $$; $$ = $2; }
2274 named_class_head_sans_basetype_defn:
2275 aggr identifier_defn %prec EMPTY
2276 { current_aggr = $$; $$ = $2; }
2279 named_complex_class_head_sans_basetype:
2280 aggr nested_name_specifier identifier
2283 if (TREE_CODE ($3) == TYPE_DECL)
2287 cp_error ("`%T' does not have a nested type named `%D'",
2290 (current_aggr, make_anon_name (), NULL_TREE, 1);
2291 $$ = TYPE_MAIN_DECL ($$);
2294 | aggr template_type
2295 { current_aggr = $$; $$ = $2; }
2296 | aggr nested_name_specifier template_type
2297 { current_aggr = $$; $$ = $3; }
2301 /* empty */ %prec EMPTY
2302 { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
2306 named_class_head_sans_basetype %prec EMPTY
2307 { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
2308 | named_class_head_sans_basetype_defn do_xref_defn
2309 maybe_base_class_list %prec EMPTY
2313 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2315 | named_complex_class_head_sans_basetype maybe_base_class_list
2317 $$ = TREE_TYPE ($1);
2318 if (TREE_INT_CST_LOW (current_aggr) == union_type
2319 && TREE_CODE ($$) != UNION_TYPE)
2320 cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
2321 else if (TREE_CODE ($$) == UNION_TYPE
2322 && TREE_INT_CST_LOW (current_aggr) != union_type)
2323 cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
2326 if (IS_AGGR_TYPE ($$) && CLASSTYPE_USE_TEMPLATE ($$))
2328 if (CLASSTYPE_IMPLICIT_INSTANTIATION ($$)
2329 && TYPE_SIZE ($$) == NULL_TREE)
2331 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION ($$);
2332 if (processing_template_decl)
2333 push_template_decl (TYPE_MAIN_DECL ($$));
2335 else if (CLASSTYPE_TEMPLATE_INSTANTIATION ($$))
2336 cp_error ("specialization after instantiation of `%T'", $$);
2338 xref_basetypes (current_aggr, $1, $$, $2);
2345 { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
2346 yyungetc ('{', 1); }
2354 maybe_base_class_list:
2355 /* empty */ %prec EMPTY
2357 | ':' see_typename %prec EMPTY
2358 { yyungetc(':', 1); $$ = NULL_TREE; }
2359 | ':' see_typename base_class_list %prec EMPTY
2365 | base_class_list ',' see_typename base_class
2366 { $$ = chainon ($$, $4); }
2372 tree type = TREE_TYPE ($1);
2373 if (! is_aggr_type (type, 1))
2375 else if (current_aggr == signature_type_node
2376 && (! type) && (! IS_SIGNATURE (type)))
2378 error ("class name not allowed as base signature");
2381 else if (current_aggr == signature_type_node)
2383 sorry ("signature inheritance, base type `%s' ignored",
2384 IDENTIFIER_POINTER ($$));
2385 $$ = build_tree_list (access_public_node, type);
2387 else if (type && IS_SIGNATURE (type))
2389 error ("signature name not allowed as base class");
2393 $$ = build_tree_list (access_default_node, type);
2395 | base_class_access_list see_typename base_class.1
2397 tree type = TREE_TYPE ($3);
2398 if (current_aggr == signature_type_node)
2399 error ("access and source specifiers not allowed in signature");
2400 if (! IS_AGGR_TYPE (type))
2402 else if (current_aggr == signature_type_node
2403 && (! type) && (! IS_SIGNATURE (type)))
2405 error ("class name not allowed as base signature");
2408 else if (current_aggr == signature_type_node)
2410 sorry ("signature inheritance, base type `%s' ignored",
2411 IDENTIFIER_POINTER ($$));
2412 $$ = build_tree_list (access_public_node, type);
2414 else if (type && IS_SIGNATURE (type))
2416 error ("signature name not allowed as base class");
2420 $$ = build_tree_list ($$, type);
2426 | TYPENAME_KEYWORD nested_name_specifier identifier
2427 { $$ = TYPE_MAIN_DECL (make_typename_type ($2, $3)); }
2428 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2429 { $$ = TYPE_MAIN_DECL (make_typename_type ($3, $4)); }
2430 | SIGOF '(' expr ')'
2432 if (current_aggr == signature_type_node)
2434 if (IS_AGGR_TYPE (TREE_TYPE ($3)))
2436 sorry ("`sigof' as base signature specifier");
2437 $$ = TREE_TYPE ($3);
2441 error ("`sigof' applied to non-aggregate expression");
2442 $$ = error_mark_node;
2447 error ("`sigof' in struct or class declaration");
2448 $$ = error_mark_node;
2451 | SIGOF '(' type_id ')'
2453 if (current_aggr == signature_type_node)
2455 if (IS_AGGR_TYPE (groktypename ($3.t)))
2457 sorry ("`sigof' as base signature specifier");
2458 $$ = groktypename ($3.t);
2462 error ("`sigof' applied to non-aggregate expression");
2463 $$ = error_mark_node;
2468 error ("`sigof' in struct or class declaration");
2469 $$ = error_mark_node;
2474 base_class_access_list:
2475 VISSPEC see_typename
2476 | SCSPEC see_typename
2477 { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
2478 sorry ("non-virtual access");
2479 $$ = access_default_virtual_node; }
2480 | base_class_access_list VISSPEC see_typename
2482 if ($2 == access_protected_node)
2484 warning ("`protected' access not implemented");
2485 $2 = access_public_node;
2488 else if ($2 == access_public_node)
2490 if ($1 == access_private_node)
2493 error ("base class cannot be public and private");
2495 else if ($1 == access_default_virtual_node)
2496 $$ = access_public_virtual_node;
2498 else /* $2 == access_private_node */
2500 if ($1 == access_public_node)
2502 else if ($1 == access_default_virtual_node)
2503 $$ = access_private_virtual_node;
2506 | base_class_access_list SCSPEC see_typename
2507 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2508 sorry ("non-virtual access");
2509 if ($$ == access_public_node)
2510 $$ = access_public_virtual_node;
2511 else if ($$ == access_private_node)
2512 $$ = access_private_virtual_node; }
2517 { tree t = $<ttype>0;
2518 push_obstacks_nochange ();
2519 end_temporary_allocation ();
2521 if (t == error_mark_node
2522 || ! IS_AGGR_TYPE (t))
2524 t = $<ttype>0 = make_lang_type (RECORD_TYPE);
2525 pushtag (make_anon_name (), t, 0);
2528 duplicate_tag_error (t);
2529 if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
2531 t = make_lang_type (TREE_CODE (t));
2532 pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
2535 if (processing_template_decl && TYPE_CONTEXT (t)
2536 && ! current_class_type)
2537 push_template_decl (TYPE_STUB_DECL (t));
2539 TYPE_BEING_DEFINED (t) = 1;
2540 if (IS_AGGR_TYPE (t) && CLASSTYPE_USE_TEMPLATE (t))
2542 if (CLASSTYPE_IMPLICIT_INSTANTIATION (t)
2543 && TYPE_SIZE (t) == NULL_TREE)
2545 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
2546 if (processing_template_decl)
2547 push_template_decl (TYPE_MAIN_DECL (t));
2549 else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
2550 cp_error ("specialization after instantiation of `%T'", t);
2552 /* Reset the interface data, at the earliest possible
2553 moment, as it might have been set via a class foo;
2555 /* Don't change signatures. */
2556 if (! IS_SIGNATURE (t))
2558 extern tree pending_vtables;
2560 tree name = TYPE_IDENTIFIER (t);
2562 if (! ANON_AGGRNAME_P (name))
2564 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
2565 SET_CLASSTYPE_INTERFACE_UNKNOWN_X
2566 (t, interface_unknown);
2569 /* Record how to set the access of this class's
2570 virtual functions. If write_virtuals == 2 or 3, then
2571 inline virtuals are ``extern inline''. */
2572 switch (write_virtuals)
2579 needs_writing = !! value_member (name, pending_vtables);
2582 needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
2583 && CLASSTYPE_INTERFACE_KNOWN (t);
2588 CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
2591 t = TYPE_IDENTIFIER ($<ttype>0);
2592 if (t && IDENTIFIER_TEMPLATE (t))
2593 overload_template_name (t, 1);
2601 $$ = build_self_reference ();
2605 opt.component_decl_list:
2607 { if ($$) $$ = build_tree_list (access_public_node, $$); }
2608 | self_reference component_decl_list
2610 if (current_aggr == signature_type_node)
2611 $$ = build_tree_list (access_public_node, $2);
2613 $$ = build_tree_list (access_default_node, $2);
2614 if ($1) $$ = tree_cons (access_public_node, $1, $$);
2616 | opt.component_decl_list VISSPEC ':' component_decl_list
2620 if (current_aggr == signature_type_node)
2622 error ("access specifier not allowed in signature");
2623 visspec = access_public_node;
2625 $$ = chainon ($$, build_tree_list (visspec, $4));
2627 | opt.component_decl_list VISSPEC ':'
2629 if (current_aggr == signature_type_node)
2630 error ("access specifier not allowed in signature");
2634 /* Note: we no longer warn about the semicolon after a component_decl_list.
2635 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2636 component_decl_list:
2638 { if ($$ == void_type_node) $$ = NULL_TREE;
2640 | component_decl_list component_decl
2641 { /* In pushdecl, we created a reverse list of names
2642 in this binding level. Make sure that the chain
2643 of what we're trying to add isn't the item itself
2644 (which can happen with what pushdecl's doing). */
2645 if ($2 != NULL_TREE && $2 != void_type_node)
2647 if (TREE_CHAIN ($2) != $$)
2648 $$ = chainon ($$, $2);
2656 component_decl_1 ';'
2658 | component_decl_1 '}'
2659 { error ("missing ';' before right brace");
2660 yyungetc ('}', 0); }
2661 /* C++: handle constructors, destructors and inline functions */
2662 /* note that INLINE is like a TYPESPEC */
2663 | fn.def2 ':' /* base_init compstmt */
2664 { $$ = finish_method ($$); }
2665 | fn.def2 TRY /* base_init compstmt */
2666 { $$ = finish_method ($$); }
2667 | fn.def2 RETURN /* base_init compstmt */
2668 { $$ = finish_method ($$); }
2669 | fn.def2 '{' /* nodecls compstmt */
2670 { $$ = finish_method ($$); }
2673 | extension component_decl
2675 pedantic = $<itype>1; }
2679 /* Do not add a "typed_declspecs declarator" rule here for
2680 speed; we need to call grok_x_components for enums, so the
2681 speedup would be insignificant. */
2682 typed_declspecs components
2683 { $$ = grok_x_components ($1.t, $2); }
2684 | declmods notype_components
2685 { $$ = grok_x_components ($1, $2); }
2686 | notype_declarator maybeasm maybe_attribute maybe_init
2687 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2688 build_tree_list ($3, NULL_TREE)); }
2689 | constructor_declarator maybeasm maybe_attribute maybe_init
2690 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2691 build_tree_list ($3, NULL_TREE)); }
2692 | ':' expr_no_commas
2693 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2697 /* These rules introduce a reduce/reduce conflict; in
2698 typedef int foo, bar;
2702 should "A::foo" be declared as a function or "A::bar" as a data
2703 member? In other words, is "bar" an after_type_declarator or a
2705 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2706 { tree specs, attrs;
2707 split_specs_attrs ($1, &specs, &attrs);
2708 $$ = grokfield ($2, specs, $5, $3,
2709 build_tree_list ($4, attrs)); }
2710 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2711 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2712 build_tree_list ($3, NULL_TREE)); }
2714 { $$ = do_class_using_decl ($1); }
2717 /* The case of exactly one component is handled directly by component_decl. */
2720 /* empty: possibly anonymous */
2722 | component_declarator0
2723 | components ',' component_declarator
2725 /* In this context, void_type_node encodes
2726 friends. They have been recorded elsewhere. */
2727 if ($$ == void_type_node)
2730 $$ = chainon ($$, $3);
2735 /* empty: possibly anonymous */
2737 | notype_component_declarator0
2738 | notype_components ',' notype_component_declarator
2740 /* In this context, void_type_node encodes
2741 friends. They have been recorded elsewhere. */
2742 if ($$ == void_type_node)
2745 $$ = chainon ($$, $3);
2749 component_declarator0:
2750 after_type_component_declarator0
2751 | notype_component_declarator0
2754 component_declarator:
2755 after_type_component_declarator
2756 | notype_component_declarator
2759 after_type_component_declarator0:
2760 after_type_declarator maybeasm maybe_attribute maybe_init
2761 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2762 &prefix_attributes);
2763 $<ttype>0 = current_declspecs;
2764 $$ = grokfield ($$, current_declspecs, $4, $2,
2765 build_tree_list ($3, prefix_attributes)); }
2766 | TYPENAME ':' expr_no_commas maybe_attribute
2767 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2768 &prefix_attributes);
2769 $<ttype>0 = current_declspecs;
2770 $$ = grokbitfield ($$, current_declspecs, $3);
2771 cplus_decl_attributes ($$, $4, prefix_attributes); }
2774 notype_component_declarator0:
2775 notype_declarator maybeasm maybe_attribute maybe_init
2776 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2777 &prefix_attributes);
2778 $<ttype>0 = current_declspecs;
2779 $$ = grokfield ($$, current_declspecs, $4, $2,
2780 build_tree_list ($3, prefix_attributes)); }
2781 | constructor_declarator maybeasm maybe_attribute maybe_init
2782 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2783 &prefix_attributes);
2784 $<ttype>0 = current_declspecs;
2785 $$ = grokfield ($$, current_declspecs, $4, $2,
2786 build_tree_list ($3, prefix_attributes)); }
2787 | IDENTIFIER ':' expr_no_commas maybe_attribute
2788 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2789 &prefix_attributes);
2790 $<ttype>0 = current_declspecs;
2791 $$ = grokbitfield ($$, current_declspecs, $3);
2792 cplus_decl_attributes ($$, $4, prefix_attributes); }
2793 | ':' expr_no_commas maybe_attribute
2794 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2795 &prefix_attributes);
2796 $<ttype>0 = current_declspecs;
2797 $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2798 cplus_decl_attributes ($$, $3, prefix_attributes); }
2801 after_type_component_declarator:
2802 after_type_declarator maybeasm maybe_attribute maybe_init
2803 { $$ = grokfield ($$, current_declspecs, $4, $2,
2804 build_tree_list ($3, prefix_attributes)); }
2805 | TYPENAME ':' expr_no_commas maybe_attribute
2806 { $$ = grokbitfield ($$, current_declspecs, $3);
2807 cplus_decl_attributes ($$, $4, prefix_attributes); }
2810 notype_component_declarator:
2811 notype_declarator maybeasm maybe_attribute maybe_init
2812 { $$ = grokfield ($$, current_declspecs, $4, $2,
2813 build_tree_list ($3, prefix_attributes)); }
2814 | IDENTIFIER ':' expr_no_commas maybe_attribute
2815 { $$ = grokbitfield ($$, current_declspecs, $3);
2816 cplus_decl_attributes ($$, $4, prefix_attributes); }
2817 | ':' expr_no_commas maybe_attribute
2818 { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2819 cplus_decl_attributes ($$, $3, prefix_attributes); }
2822 /* We chain the enumerators in reverse order.
2823 Because of the way enums are built, the order is
2824 insignificant. Take advantage of this fact. */
2828 | enumlist ',' enumerator
2829 { TREE_CHAIN ($3) = $$; $$ = $3; }
2834 { $$ = build_enumerator ($$, NULL_TREE); }
2835 | identifier '=' expr_no_commas
2836 { $$ = build_enumerator ($$, $3); }
2839 /* ANSI new-type-id (5.3.4) */
2841 type_specifier_seq new_declarator
2842 { $$.t = build_decl_list ($1.t, $2);
2843 $$.new_type_flag = $1.new_type_flag; }
2844 | type_specifier_seq %prec EMPTY
2845 { $$.t = build_decl_list ($1.t, NULL_TREE);
2846 $$.new_type_flag = $1.new_type_flag; }
2847 /* GNU extension to allow arrays of arbitrary types with
2848 non-constant dimension. */
2849 | '(' type_id ')' '[' expr ']'
2852 pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
2853 $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
2854 $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
2855 $$.new_type_flag = $2.new_type_flag;
2860 /* empty */ %prec EMPTY
2862 | cv_qualifiers CV_QUALIFIER
2863 { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
2866 nonempty_cv_qualifiers:
2868 { $$.t = IDENTIFIER_AS_LIST ($1);
2869 $$.new_type_flag = 0; }
2870 | nonempty_cv_qualifiers CV_QUALIFIER
2871 { $$.t = decl_tree_cons (NULL_TREE, $2, $1.t);
2872 $$.new_type_flag = $1.new_type_flag; }
2875 /* These rules must follow the rules for function declarations
2876 and component declarations. That way, longer rules are preferred. */
2880 { $<itype>$ = suspend_momentary (); }
2882 /* An expression which will not live on the momentary obstack. */
2885 { resume_momentary ((int) $<itype>1); $$ = $2; }
2888 /* An expression which will not live on the momentary obstack. */
2890 suspend_mom '(' nonnull_exprlist ')'
2891 { resume_momentary ((int) $<itype>1); $$ = $3; }
2892 | suspend_mom '(' parmlist ')'
2893 { resume_momentary ((int) $<itype>1); $$ = $3; }
2894 | suspend_mom LEFT_RIGHT
2895 { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
2896 | suspend_mom '(' error ')'
2897 { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
2900 /* A declarator that is allowed only after an explicit typespec. */
2901 /* may all be followed by prec '.' */
2902 after_type_declarator:
2903 '*' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2904 { $$ = make_pointer_declarator ($2.t, $3); }
2905 | '&' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2906 { $$ = make_reference_declarator ($2.t, $3); }
2907 | '*' after_type_declarator %prec UNARY
2908 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2909 | '&' after_type_declarator %prec UNARY
2910 { $$ = make_reference_declarator (NULL_TREE, $2); }
2911 | ptr_to_mem cv_qualifiers after_type_declarator
2912 { tree arg = make_pointer_declarator ($2, $3);
2913 $$ = build_parse_node (SCOPE_REF, $1, arg);
2915 | direct_after_type_declarator
2919 type_name %prec EMPTY
2921 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2923 if (current_class_type
2924 && TYPE_BEING_DEFINED (current_class_type)
2925 && ! IDENTIFIER_CLASS_VALUE ($1))
2927 /* Be sure to get an inherited typedef. */
2928 $$ = lookup_name ($1, 1);
2929 /* Remember that this name has been used in the class
2930 definition, as per [class.scope0] */
2931 pushdecl_class_level ($$);
2934 $$ = identifier_typedecl_value ($1);
2939 | global_scope type_name
2941 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2942 $$ = identifier_typedecl_value ($2);
2945 got_scope = NULL_TREE;
2948 | global_scope nested_type
2953 nested_name_specifier type_name %prec EMPTY
2954 { $$ = get_type_decl ($2); }
2957 direct_after_type_declarator:
2958 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2959 { $$ = make_call_declarator ($$, $2, $3, $4); }
2960 | direct_after_type_declarator '[' nonmomentary_expr ']'
2961 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2962 | direct_after_type_declarator '[' ']'
2963 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2964 | '(' after_type_declarator ')'
2966 | nested_name_specifier type_name %prec EMPTY
2967 { push_nested_class ($1, 3);
2968 $$ = build_parse_node (SCOPE_REF, $$, $2);
2969 TREE_COMPLEXITY ($$) = current_class_depth; }
2970 | type_name %prec EMPTY
2973 /* A declarator allowed whether or not there has been
2974 an explicit typespec. These cannot redeclare a typedef-name. */
2977 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2978 { $$ = make_pointer_declarator ($2.t, $3); }
2979 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2980 { $$ = make_reference_declarator ($2.t, $3); }
2981 | '*' notype_declarator %prec UNARY
2982 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2983 | '&' notype_declarator %prec UNARY
2984 { $$ = make_reference_declarator (NULL_TREE, $2); }
2985 | ptr_to_mem cv_qualifiers notype_declarator
2986 { tree arg = make_pointer_declarator ($2, $3);
2987 $$ = build_parse_node (SCOPE_REF, $1, arg);
2989 | direct_notype_declarator
2992 complex_notype_declarator:
2993 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2994 { $$ = make_pointer_declarator ($2.t, $3); }
2995 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2996 { $$ = make_reference_declarator ($2.t, $3); }
2997 | '*' complex_notype_declarator %prec UNARY
2998 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2999 | '&' complex_notype_declarator %prec UNARY
3000 { $$ = make_reference_declarator (NULL_TREE, $2); }
3001 | ptr_to_mem cv_qualifiers notype_declarator
3002 { tree arg = make_pointer_declarator ($2, $3);
3003 $$ = build_parse_node (SCOPE_REF, $1, arg);
3005 | complex_direct_notype_declarator
3008 complex_direct_notype_declarator:
3009 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
3010 { $$ = make_call_declarator ($$, $2, $3, $4); }
3011 | '(' complex_notype_declarator ')'
3013 | direct_notype_declarator '[' nonmomentary_expr ']'
3014 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3015 | direct_notype_declarator '[' ']'
3016 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3017 | notype_qualified_id
3018 { if (OP0 ($$) != current_class_type)
3020 push_nested_class (OP0 ($$), 3);
3021 TREE_COMPLEXITY ($$) = current_class_depth;
3027 nested_name_specifier unqualified_id
3028 { got_scope = NULL_TREE;
3029 $$ = build_parse_node (SCOPE_REF, $$, $2); }
3032 notype_qualified_id:
3033 nested_name_specifier notype_unqualified_id
3034 { got_scope = NULL_TREE;
3035 $$ = build_parse_node (SCOPE_REF, $$, $2); }
3040 | global_scope notype_qualified_id
3045 typespec '(' nonnull_exprlist ')'
3046 { $$ = build_functional_cast ($1.t, $3); }
3047 | typespec '(' expr_or_declarator ')'
3048 { $$ = reparse_decl_as_expr ($1.t, $3); }
3049 | typespec fcast_or_absdcl %prec EMPTY
3050 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3056 | template_type %prec EMPTY
3059 nested_name_specifier:
3060 nested_name_specifier_1
3061 | nested_name_specifier nested_name_specifier_1
3065 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3066 inline here?!? (jason) */
3067 nested_name_specifier_1:
3070 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3073 /* Remember that this name has been used in the class
3074 definition, as per [class.scope0] */
3075 if (current_class_type
3076 && TYPE_BEING_DEFINED (current_class_type)
3077 && ! IDENTIFIER_CLASS_VALUE ($1))
3078 pushdecl_class_level ($$);
3080 got_scope = $$ = TREE_TYPE ($$);
3084 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3086 got_scope = $$ = TREE_TYPE ($$);
3090 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3092 if (TREE_CODE ($$) == NAMESPACE_DECL
3093 && DECL_NAME ($$) == get_identifier ("std"))
3094 got_scope = void_type_node;
3098 | template_type SCOPE
3099 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3100 /* These break 'const i;'
3104 cp_error ("`%D' is not an aggregate typedef",
3105 lastiddecl ? lastiddecl : $$);
3106 $$ = error_mark_node;
3109 { goto failed_scope; } */
3113 global_scope type_name
3115 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3116 $$ = identifier_typedecl_value ($2);
3119 got_scope = NULL_TREE;
3122 | global_scope nested_type
3127 nested_name_specifier '*'
3128 { got_scope = NULL_TREE; }
3129 | global_scope nested_name_specifier '*'
3130 { $$ = $2; got_scope = NULL_TREE; }
3133 /* All uses of explicit global scope must go through this nonterminal so
3134 that got_scope will be set before yylex is called to get the next token. */
3137 { got_scope = void_type_node; }
3140 /* ANSI new-declarator (5.3.4) */
3142 '*' cv_qualifiers new_declarator
3143 { $$ = make_pointer_declarator ($2, $3); }
3144 | '*' cv_qualifiers %prec EMPTY
3145 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3146 | '&' cv_qualifiers new_declarator %prec EMPTY
3147 { $$ = make_reference_declarator ($2, $3); }
3148 | '&' cv_qualifiers %prec EMPTY
3149 { $$ = make_reference_declarator ($2, NULL_TREE); }
3150 | ptr_to_mem cv_qualifiers %prec EMPTY
3151 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3152 $$ = build_parse_node (SCOPE_REF, $1, arg);
3154 | ptr_to_mem cv_qualifiers new_declarator
3155 { tree arg = make_pointer_declarator ($2, $3);
3156 $$ = build_parse_node (SCOPE_REF, $1, arg);
3158 | direct_new_declarator %prec EMPTY
3161 /* ANSI direct-new-declarator (5.3.4) */
3162 direct_new_declarator:
3164 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3165 | direct_new_declarator '[' nonmomentary_expr ']'
3166 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3169 /* ANSI abstract-declarator (8.1) */
3171 '*' nonempty_cv_qualifiers absdcl
3172 { $$ = make_pointer_declarator ($2.t, $3); }
3174 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3175 | '*' nonempty_cv_qualifiers %prec EMPTY
3176 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3178 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3179 | '&' nonempty_cv_qualifiers absdcl
3180 { $$ = make_reference_declarator ($2.t, $3); }
3182 { $$ = make_reference_declarator (NULL_TREE, $2); }
3183 | '&' nonempty_cv_qualifiers %prec EMPTY
3184 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3186 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3187 | ptr_to_mem cv_qualifiers %prec EMPTY
3188 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3189 $$ = build_parse_node (SCOPE_REF, $1, arg);
3191 | ptr_to_mem cv_qualifiers absdcl
3192 { tree arg = make_pointer_declarator ($2, $3);
3193 $$ = build_parse_node (SCOPE_REF, $1, arg);
3195 | direct_abstract_declarator %prec EMPTY
3198 /* ANSI direct-abstract-declarator (8.1) */
3199 direct_abstract_declarator:
3202 /* `(typedef)1' is `int'. */
3204 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3205 { $$ = make_call_declarator ($$, $3, $5, $6); }
3206 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3207 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3208 | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
3209 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3210 | direct_abstract_declarator '[' ']' %prec '.'
3211 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3212 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3213 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3214 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3215 { set_quals_and_spec ($$, $2, $3); }
3216 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3217 { set_quals_and_spec ($$, $2, $3); }
3218 | '[' nonmomentary_expr ']' %prec '.'
3219 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3221 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
3224 /* For C++, decls and stmts can be intermixed, so we don't need to
3225 have a special rule that won't start parsing the stmt section
3226 until we have a stmt that parses without errors. */
3239 /* build the LET_STMT node before parsing its contents,
3240 so that any LET_STMTs within the context can have their display pointers
3241 set up to point at this one. */
3245 { do_pushlevel (); }
3250 { $$ = do_poplevel (); }
3253 /* Read zero or more forward-declarations for labels
3254 that nested functions can jump to. */
3259 pedwarn ("ANSI C++ forbids label declarations"); }
3264 | label_decls label_decl
3268 LABEL identifiers_or_typenames ';'
3270 for (link = $2; link; link = TREE_CHAIN (link))
3272 tree label = shadow_label (TREE_VALUE (link));
3273 C_DECLARED_LABEL_FLAG (label) = 1;
3274 declare_nonlocal_label (label);
3279 /* This is the body of a function definition.
3280 It causes syntax errors to ignore to the next openbrace. */
3290 if (processing_template_decl)
3292 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3293 add_tree ($<ttype>$);
3296 .pushlevel compstmtend .poplevel
3298 if (processing_template_decl)
3300 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3301 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3302 last_tree = $<ttype>2;
3311 if (processing_template_decl)
3313 $<ttype>$ = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE,
3315 add_tree ($<ttype>$);
3317 cond_stmt_keyword = "if";
3319 .pushlevel paren_cond_or_null
3321 if (processing_template_decl)
3323 if (last_tree != $<ttype>2)
3325 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3326 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3327 last_tree = $<ttype>2;
3330 TREE_OPERAND ($<ttype>2, 0) = $4;
3334 emit_line_note (input_filename, lineno);
3335 expand_start_cond ($4, 0);
3338 implicitly_scoped_stmt
3340 if (processing_template_decl)
3342 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3343 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3344 $<ttype>$ = last_tree = $<ttype>2;
3349 implicitly_scoped_stmt:
3354 if (processing_template_decl)
3356 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3357 add_tree ($<ttype>$);
3360 simple_stmt .poplevel
3362 if (processing_template_decl)
3364 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3365 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3366 last_tree = $<ttype>2;
3384 if (! processing_template_decl)
3386 emit_line_note (input_filename, lineno);
3387 /* Do default conversion if safe and possibly important,
3388 in case within ({...}). */
3389 if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
3391 || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
3392 expr = default_conversion (expr);
3394 cplus_expand_expr_stmt (expr);
3398 { if (! processing_template_decl) expand_start_else (); }
3399 implicitly_scoped_stmt
3401 if (processing_template_decl)
3403 TREE_OPERAND ($<ttype>1, 2) = TREE_CHAIN ($<ttype>1);
3404 TREE_CHAIN ($<ttype>1) = NULL_TREE;
3405 last_tree = $<ttype>1;
3412 | simple_if %prec IF
3413 { if (! processing_template_decl) expand_end_cond ();
3418 if (processing_template_decl)
3420 $<ttype>$ = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
3421 add_tree ($<ttype>$);
3426 emit_line_note (input_filename, lineno);
3427 expand_start_loop (1);
3429 cond_stmt_keyword = "while";
3431 .pushlevel paren_cond_or_null
3433 if (processing_template_decl)
3435 if (last_tree != $<ttype>2)
3437 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3438 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3439 last_tree = $<ttype>2;
3442 TREE_OPERAND ($<ttype>2, 0) = $4;
3446 emit_line_note (input_filename, lineno);
3447 expand_exit_loop_if_false (0, $4);
3450 already_scoped_stmt .poplevel
3452 if (processing_template_decl)
3454 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3455 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3456 last_tree = $<ttype>2;
3464 if (processing_template_decl)
3466 $<ttype>$ = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
3467 add_tree ($<ttype>$);
3472 emit_line_note (input_filename, lineno);
3473 expand_start_loop_continue_elsewhere (1);
3476 implicitly_scoped_stmt WHILE
3478 if (processing_template_decl)
3480 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3481 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3482 last_tree = $<ttype>2;
3486 expand_loop_continue_here ();
3487 cond_stmt_keyword = "do";
3490 paren_expr_or_null ';'
3492 if (processing_template_decl)
3493 TREE_OPERAND ($<ttype>2, 1) = $6;
3496 emit_line_note (input_filename, lineno);
3497 expand_exit_loop_if_false (0, $6);
3504 { if (processing_template_decl)
3506 $<ttype>$ = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
3507 NULL_TREE, NULL_TREE);
3508 add_tree ($<ttype>$);
3511 emit_line_note (input_filename, lineno);
3512 if (flag_new_for_scope > 0)
3514 /* Conditionalize .pushlevel */
3516 note_level_for_for ();
3519 expand_start_bindings (0);
3522 '(' for.init.statement
3524 if (processing_template_decl)
3526 if (last_tree != $<ttype>2)
3528 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3529 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3530 last_tree = $<ttype>2;
3536 emit_line_note (input_filename, lineno);
3537 expand_start_loop_continue_elsewhere (1);
3540 .pushlevel xcond ';'
3542 if (processing_template_decl)
3544 if (last_tree != $<ttype>2)
3546 TREE_OPERAND ($<ttype>2, 1) = last_tree;
3547 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3548 last_tree = $<ttype>2;
3551 TREE_OPERAND ($<ttype>2, 1) = $7;
3555 emit_line_note (input_filename, lineno);
3556 if ($7) expand_exit_loop_if_false (0, $7);
3560 /* Don't let the tree nodes for $10 be discarded
3561 by clear_momentary during the parsing of the next stmt. */
3563 if (processing_template_decl)
3564 TREE_OPERAND ($<ttype>2, 2) = $10;
3567 already_scoped_stmt .poplevel
3569 if (processing_template_decl)
3571 TREE_OPERAND ($<ttype>2, 3) = TREE_CHAIN ($<ttype>2);
3572 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3573 last_tree = $<ttype>2;
3577 emit_line_note (input_filename, lineno);
3578 expand_loop_continue_here ();
3579 if ($10) cplus_expand_expr_stmt ($10);
3583 if (flag_new_for_scope > 0)
3588 | SWITCH .pushlevel '(' condition ')'
3590 if (processing_template_decl)
3592 $<ttype>$ = build_min_nt (SWITCH_STMT, $4, NULL_TREE);
3593 add_tree ($<ttype>$);
3597 emit_line_note (input_filename, lineno);
3598 c_expand_start_case ($4);
3601 /* Don't let the tree nodes for $4 be discarded by
3602 clear_momentary during the parsing of the next stmt. */
3605 implicitly_scoped_stmt
3607 if (processing_template_decl)
3609 TREE_OPERAND ($<ttype>6, 1) = TREE_CHAIN ($<ttype>6);
3610 TREE_CHAIN ($<ttype>6) = NULL_TREE;
3611 last_tree = $<ttype>6;
3614 expand_end_case ($4);
3620 | CASE expr_no_commas ':'
3621 { do_case ($2, NULL_TREE); }
3623 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3624 { do_case ($2, $4); }
3627 { do_case (NULL_TREE, NULL_TREE); }
3630 { emit_line_note (input_filename, lineno);
3631 if (processing_template_decl)
3632 add_tree (build_min_nt (BREAK_STMT));
3633 else if ( ! expand_exit_something ())
3634 error ("break statement not within loop or switch"); }
3636 { emit_line_note (input_filename, lineno);
3637 if (processing_template_decl)
3638 add_tree (build_min_nt (CONTINUE_STMT));
3639 else if (! expand_continue_loop (0))
3640 error ("continue statement not within a loop"); }
3642 { emit_line_note (input_filename, lineno);
3643 c_expand_return (NULL_TREE); }
3645 { emit_line_note (input_filename, lineno);
3646 c_expand_return ($2);
3649 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3650 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3651 emit_line_note (input_filename, lineno);
3655 /* This is the case with just output operands. */
3656 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3657 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3658 emit_line_note (input_filename, lineno);
3659 c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
3660 $2 == ridpointers[(int)RID_VOLATILE],
3661 input_filename, lineno);
3664 /* This is the case with input operands as well. */
3665 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
3666 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3667 emit_line_note (input_filename, lineno);
3668 c_expand_asm_operands ($4, $6, $8, NULL_TREE,
3669 $2 == ridpointers[(int)RID_VOLATILE],
3670 input_filename, lineno);
3673 /* This is the case with clobbered registers as well. */
3674 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3675 asm_operands ':' asm_clobbers ')' ';'
3676 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3677 emit_line_note (input_filename, lineno);
3678 c_expand_asm_operands ($4, $6, $8, $10,
3679 $2 == ridpointers[(int)RID_VOLATILE],
3680 input_filename, lineno);
3685 if (processing_template_decl)
3686 add_tree (build_min_nt (GOTO_STMT, $3));
3688 { emit_line_note (input_filename, lineno);
3689 expand_computed_goto ($3); }
3691 | GOTO identifier ';'
3693 if (processing_template_decl)
3694 add_tree (build_min_nt (GOTO_STMT, $2));
3698 emit_line_note (input_filename, lineno);
3699 decl = lookup_label ($2);
3700 TREE_USED (decl) = 1;
3707 { error ("label must be followed by statement");
3718 if (! current_function_parms_stored)
3719 store_parm_decls ();
3720 expand_start_early_try_stmts ();
3722 ctor_initializer_opt compstmt_or_error
3723 { expand_start_all_catch (); }
3726 int nested = (hack_decl_function_context
3727 (current_function_decl) != NULL_TREE);
3728 expand_end_all_catch ();
3729 finish_function (lineno, (int)$3, nested);
3736 if (processing_template_decl)
3738 $<ttype>$ = build_min_nt (TRY_BLOCK, NULL_TREE,
3740 add_tree ($<ttype>$);
3744 emit_line_note (input_filename, lineno);
3745 expand_start_try_stmts ();
3750 if (processing_template_decl)
3752 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3753 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3754 last_tree = $<ttype>2;
3757 expand_start_all_catch ();
3761 if (processing_template_decl)
3763 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3764 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3765 last_tree = $<ttype>2;
3768 expand_end_all_catch ();
3774 | handler_seq handler
3780 if (processing_template_decl)
3782 $<ttype>$ = build_min_nt (HANDLER, NULL_TREE,
3784 add_tree ($<ttype>$);
3787 .pushlevel handler_args
3789 if (processing_template_decl)
3791 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3792 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3793 last_tree = $<ttype>2;
3798 if (processing_template_decl)
3800 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3801 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3802 last_tree = $<ttype>2;
3805 expand_end_catch_block ();
3811 typed_typespecs %prec EMPTY
3812 | nonempty_cv_qualifiers %prec EMPTY
3817 { expand_start_catch_block (NULL_TREE, NULL_TREE); }
3818 /* This doesn't allow reference parameters, the below does.
3819 | '(' type_specifier_seq absdcl ')'
3820 { check_for_new_type ("inside exception declarations", $2);
3821 expand_start_catch_block ($2.t, $3); }
3822 | '(' type_specifier_seq ')'
3823 { check_for_new_type ("inside exception declarations", $2);
3824 expand_start_catch_block ($2.t, NULL_TREE); }
3825 | '(' type_specifier_seq notype_declarator ')'
3826 { check_for_new_type ("inside exception declarations", $2);
3827 expand_start_catch_block ($2.t, $3); }
3828 | '(' typed_typespecs after_type_declarator ')'
3829 { check_for_new_type ("inside exception declarations", $2);
3830 expand_start_catch_block ($2.t, $3); }
3831 This allows reference parameters... */
3833 { check_for_new_type ("inside exception declarations", $2);
3834 expand_start_catch_block (TREE_PURPOSE ($2.t),
3835 TREE_VALUE ($2.t)); }
3842 label = define_label (input_filename, lineno, $1);
3843 if (label && ! minimal_parse_mode)
3844 expand_label (label);
3856 { if ($1) cplus_expand_expr_stmt ($1); }
3860 pedwarn ("ANSI C++ forbids compound statements inside for initializations");
3864 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3868 { emit_line_note (input_filename, lineno);
3871 { emit_line_note (input_filename, lineno); }
3882 /* These are the operands other than the first string and colon
3883 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3887 | nonnull_asm_operands
3890 nonnull_asm_operands:
3892 | nonnull_asm_operands ',' asm_operand
3893 { $$ = chainon ($$, $3); }
3898 { $$ = build_tree_list ($$, $3); }
3903 { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
3904 | asm_clobbers ',' STRING
3905 { $$ = tree_cons (NULL_TREE, $3, $$); }
3908 /* This is what appears inside the parens in a function declarator.
3909 Its value is represented in the format that grokdeclarator expects.
3911 In C++, declaring a function with no parameters
3912 means that that function takes *no* parameters. */
3921 { $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3922 TREE_PARMLIST ($$) = 1;
3923 check_for_new_type ("inside parameter list", $1); }
3926 /* This nonterminal does not include the common sequence '(' type_id ')',
3927 as it is ambiguous and must be disambiguated elsewhere. */
3931 $$ = chainon ($$, void_list_node);
3932 TREE_PARMLIST ($$) = 1;
3934 | parms_comma ELLIPSIS
3936 TREE_PARMLIST ($$) = 1;
3938 /* C++ allows an ellipsis without a separating ',' */
3941 TREE_PARMLIST ($$) = 1;
3945 $$ = build_tree_list (NULL_TREE, $1.t);
3946 TREE_PARMLIST ($$) = 1;
3954 TREE_PARMLIST ($$) = 1;
3956 | parms TYPENAME_ELLIPSIS
3958 TREE_PARMLIST ($$) = 1;
3960 | type_id TYPENAME_ELLIPSIS
3962 $$ = build_tree_list (NULL_TREE, $1.t);
3963 TREE_PARMLIST ($$) = 1;
3967 /* This helps us recover from really nasty
3968 parse errors, for example, a missing right
3970 yyerror ("possibly missing ')'");
3971 $$ = chainon ($$, void_list_node);
3972 TREE_PARMLIST ($$) = 1;
3978 /* This helps us recover from really nasty
3979 parse errors, for example, a missing right
3981 yyerror ("possibly missing ')'");
3982 $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3983 TREE_PARMLIST ($$) = 1;
3989 /* A default argument to a */
3992 { maybe_snarf_defarg (); }
4002 /* A nonempty list of parameter declarations or type names. */
4005 { check_for_new_type ("in a parameter list", $1);
4006 $$ = build_tree_list (NULL_TREE, $1.t); }
4008 { check_for_new_type ("in a parameter list", $1);
4009 $$ = build_tree_list ($2, $1.t); }
4010 | parms_comma full_parm
4011 { check_for_new_type ("in a parameter list", $2);
4012 $$ = chainon ($$, $2.t); }
4013 | parms_comma bad_parm
4014 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
4015 | parms_comma bad_parm '=' init
4016 { $$ = chainon ($$, build_tree_list ($4, $2)); }
4022 { check_for_new_type ("in a parameter list", $1);
4023 $$ = build_tree_list (NULL_TREE, $1.t); }
4026 /* A single parameter declaration or parameter type name,
4027 as found in a parmlist. */
4029 /* Here we expand typed_declspecs inline to avoid mis-parsing of
4030 TYPESPEC IDENTIFIER. */
4031 typed_declspecs1 declarator
4032 { tree specs = strip_attrs ($1.t);
4033 $$.new_type_flag = $1.new_type_flag;
4034 $$.t = build_tree_list (specs, $2); }
4035 | typed_typespecs declarator
4036 { $$.t = build_tree_list ($1.t, $2);
4037 $$.new_type_flag = $1.new_type_flag; }
4038 | typespec declarator
4039 { $$.t = build_tree_list (get_decl_list ($1.t), $2);
4040 $$.new_type_flag = $1.new_type_flag; }
4041 | typed_declspecs1 absdcl
4042 { tree specs = strip_attrs ($1.t);
4043 $$.t = build_tree_list (specs, $2);
4044 $$.new_type_flag = $1.new_type_flag; }
4045 | typed_declspecs1 %prec EMPTY
4046 { tree specs = strip_attrs ($1.t);
4047 $$.t = build_tree_list (specs, NULL_TREE);
4048 $$.new_type_flag = $1.new_type_flag; }
4049 | declmods notype_declarator
4050 { tree specs = strip_attrs ($1);
4051 $$.t = build_tree_list (specs, $2);
4052 $$.new_type_flag = 0; }
4057 { $$.t = build_tree_list (NULL_TREE, $1.t);
4058 $$.new_type_flag = $1.new_type_flag; }
4060 { $$.t = build_tree_list ($2, $1.t);
4061 $$.new_type_flag = $1.new_type_flag; }
4070 /* empty */ %prec EMPTY
4071 { see_typename (); }
4075 /* empty */ %prec EMPTY
4077 error ("type specifier omitted for parameter");
4078 $$ = build_tree_list (integer_type_node, NULL_TREE);
4082 error ("type specifier omitted for parameter");
4083 if (TREE_CODE ($$) == SCOPE_REF
4084 && TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM)
4085 cp_error (" perhaps you want `typename %E' to make it a type", $$);
4086 $$ = build_tree_list (integer_type_node, $$);
4090 exception_specification_opt:
4091 /* empty */ %prec EMPTY
4093 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
4095 | THROW LEFT_RIGHT %prec EMPTY
4096 { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
4099 ansi_raise_identifier:
4101 { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
4104 ansi_raise_identifiers:
4105 ansi_raise_identifier
4106 | ansi_raise_identifiers ',' ansi_raise_identifier
4108 TREE_CHAIN ($3) = $$;
4113 conversion_declarator:
4114 /* empty */ %prec EMPTY
4116 | '*' cv_qualifiers conversion_declarator
4117 { $$ = make_pointer_declarator ($2, $3); }
4118 | '&' cv_qualifiers conversion_declarator
4119 { $$ = make_reference_declarator ($2, $3); }
4120 | ptr_to_mem cv_qualifiers conversion_declarator
4121 { tree arg = make_pointer_declarator ($2, $3);
4122 $$ = build_parse_node (SCOPE_REF, $1, arg);
4128 { got_scope = NULL_TREE; }
4133 { $$ = ansi_opname[MULT_EXPR]; }
4135 { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
4137 { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
4139 { $$ = ansi_opname[PLUS_EXPR]; }
4141 { $$ = ansi_opname[MINUS_EXPR]; }
4143 { $$ = ansi_opname[BIT_AND_EXPR]; }
4145 { $$ = ansi_opname[BIT_IOR_EXPR]; }
4147 { $$ = ansi_opname[BIT_XOR_EXPR]; }
4149 { $$ = ansi_opname[BIT_NOT_EXPR]; }
4151 { $$ = ansi_opname[COMPOUND_EXPR]; }
4152 | operator ARITHCOMPARE
4153 { $$ = ansi_opname[$2]; }
4155 { $$ = ansi_opname[LT_EXPR]; }
4157 { $$ = ansi_opname[GT_EXPR]; }
4158 | operator EQCOMPARE
4159 { $$ = ansi_opname[$2]; }
4161 { $$ = ansi_assopname[$2]; }
4163 { $$ = ansi_opname [MODIFY_EXPR]; }
4165 { $$ = ansi_opname[$2]; }
4167 { $$ = ansi_opname[$2]; }
4169 { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
4170 | operator MINUSMINUS
4171 { $$ = ansi_opname[PREDECREMENT_EXPR]; }
4173 { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
4175 { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
4177 { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
4179 { $$ = ansi_opname[COND_EXPR]; }
4181 { $$ = ansi_opname[$2]; }
4182 | operator POINTSAT %prec EMPTY
4183 { $$ = ansi_opname[COMPONENT_REF]; }
4184 | operator POINTSAT_STAR %prec EMPTY
4185 { $$ = ansi_opname[MEMBER_REF]; }
4186 | operator LEFT_RIGHT
4187 { $$ = ansi_opname[CALL_EXPR]; }
4189 { $$ = ansi_opname[ARRAY_REF]; }
4190 | operator NEW %prec EMPTY
4191 { $$ = ansi_opname[NEW_EXPR]; }
4192 | operator DELETE %prec EMPTY
4193 { $$ = ansi_opname[DELETE_EXPR]; }
4194 | operator NEW '[' ']'
4195 { $$ = ansi_opname[VEC_NEW_EXPR]; }
4196 | operator DELETE '[' ']'
4197 { $$ = ansi_opname[VEC_DELETE_EXPR]; }
4198 /* Names here should be looked up in class scope ALSO. */
4199 | operator type_specifier_seq conversion_declarator
4200 { $$ = grokoptypename ($2.t, $3); }
4202 { $$ = ansi_opname[ERROR_MARK]; }
4209 debug_yytranslate (value)
4212 return yytname[YYTRANSLATE (value)];