1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 89, 93, 94, 95, 1996 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 /* This grammar is based on the GNU CC grammar. */
25 /* Note: Bison automatically applies a default action of "$$ = $1" for
26 all derivations; this is applied before the explicit action, if one
27 is given. Keep this in mind when reading the actions. */
30 /* Cause the `yydebug' variable to be defined. */
45 /* Since parsers are distinct for each language, put the language string
46 definition here. (fnf) */
47 char *language_string = "GNU C++";
49 extern tree void_list_node;
50 extern struct obstack permanent_obstack;
56 extern int end_of_file;
57 extern int current_class_depth;
58 extern tree last_tree;
60 /* FSF LOCAL dje prefix attributes */
61 extern tree strip_attrs PROTO((tree));
66 /* Like YYERROR but do call yyerror. */
67 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
69 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
70 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
72 /* Contains the statement keyword (if/while/do) to include in an
73 error message if the user supplies an empty conditional expression. */
74 static char *cond_stmt_keyword;
76 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
82 /* Cons up an empty parameter list. */
92 || current_class_type != NULL)
93 parms = void_list_node;
102 %union {long itype; tree ttype; char *strtype; enum tree_code code; flagged_type_tree ftype; }
104 /* All identifiers that are not reserved words
105 and are not declared typedefs in the current block */
108 /* All identifiers that are declared typedefs in the current block.
109 In some contexts, they are treated just like IDENTIFIER,
110 but they can also serve as typespecs in declarations. */
114 /* Reserved words that specify storage class.
115 yylval contains an IDENTIFIER_NODE which indicates which one. */
118 /* Reserved words that specify type.
119 yylval contains an IDENTIFIER_NODE which indicates which one. */
122 /* Reserved words that qualify type: "const" or "volatile".
123 yylval contains an IDENTIFIER_NODE which indicates which one. */
126 /* Character or numeric constants.
127 yylval is the node for the constant. */
130 /* String constants in raw form.
131 yylval is a STRING_CST node. */
134 /* "...", used for functions with variable arglists. */
137 /* the reserved words */
138 /* SCO include files test "ASM", so use something else. */
139 %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
140 %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
142 %token ATTRIBUTE EXTENSION LABEL
143 %token REALPART IMAGPART
145 /* the reserved words... C++ extensions */
147 %token <ttype> VISSPEC
148 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
149 %token NAMESPACE TYPENAME_KEYWORD USING
150 %token LEFT_RIGHT TEMPLATE
151 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
154 /* Define the operator tokens and their precedences.
155 The value is an integer because, if used, it is the tree code
156 to use in the expression made from the operator. */
158 %left EMPTY /* used to resolve s/r with epsilon */
162 /* Add precedence rules to solve dangling else s/r conflict */
166 %left IDENTIFIER TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
172 %right <code> ASSIGN '='
180 %left <code> EQCOMPARE
181 %left <code> ARITHCOMPARE '<' '>'
182 %left <code> LSHIFT RSHIFT
184 %left <code> '*' '/' '%'
185 %left <code> POINTSAT_STAR DOT_STAR
186 %right <code> UNARY PLUSPLUS MINUSMINUS '~'
188 %left <ttype> PAREN_STAR_PAREN LEFT_RIGHT
189 %left <code> POINTSAT '.' '(' '['
191 %right SCOPE /* C++ extension */
192 %nonassoc NEW DELETE TRY CATCH
196 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
197 %type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
198 %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
199 %type <ttype> reserved_declspecs boolean.literal
200 %type <ttype> reserved_typespecquals
201 %type <ttype> declmods
202 %type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
203 %type <itype> initdecls notype_initdecls initdcl /* C++ modification */
204 %type <ttype> init initlist maybeasm maybe_init
205 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
206 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
207 %type <ttype> any_word
209 %type <ttype> compstmt implicitly_scoped_stmt
211 %type <ttype> declarator notype_declarator after_type_declarator
212 %type <ttype> direct_notype_declarator direct_after_type_declarator
214 %type <ttype> opt.component_decl_list component_decl_list
215 %type <ttype> component_decl component_decl_1 components notype_components
216 %type <ttype> component_declarator component_declarator0 self_reference
217 %type <ttype> notype_component_declarator notype_component_declarator0
218 %type <ttype> after_type_component_declarator after_type_component_declarator0
219 %type <ttype> enumlist enumerator
220 %type <ttype> absdcl cv_qualifiers
221 %type <ttype> direct_abstract_declarator conversion_declarator
222 %type <ttype> new_declarator direct_new_declarator
223 %type <ttype> xexpr parmlist parms bad_parm
224 %type <ttype> identifiers_or_typenames
225 %type <ttype> fcast_or_absdcl regcast_or_absdcl
226 %type <ttype> expr_or_declarator complex_notype_declarator
227 %type <ttype> notype_unqualified_id unqualified_id qualified_id
228 %type <ttype> overqualified_id notype_qualified_id any_id
229 %type <ttype> complex_direct_notype_declarator functional_cast
230 %type <ttype> complex_parmlist parms_comma
232 %type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
233 %type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
234 %type <ftype> structsp typespecqual_reserved parm named_parm full_parm
237 %token <ttype> TYPENAME_ELLIPSIS PTYPENAME
238 %token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
239 %token <ttype> PRE_PARSED_CLASS_DECL
240 %type <ttype> fn.def1 /* Not really! */ component_constructor_declarator
241 %type <ttype> fn.def2 return_id fn.defpen constructor_declarator
242 %type <itype> ctor_initializer_opt
243 %type <ttype> named_class_head named_class_head_sans_basetype
244 %type <ttype> named_complex_class_head_sans_basetype
245 %type <ttype> unnamed_class_head
246 %type <ttype> class_head base_class_list
247 %type <ttype> base_class_access_list
248 %type <ttype> base_class maybe_base_class_list base_class.1
249 %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
250 %type <ttype> operator_name
251 %type <ttype> object aggr
252 %type <itype> new delete
253 /* %type <ttype> primary_no_id */
254 %type <ttype> nonmomentary_expr maybe_parmlist
255 %type <itype> initdcl0 notype_initdcl0 member_init_list
256 %type <ttype> template_header template_parm_list template_parm
257 %type <ttype> template_type_parm
258 %type <code> template_close_bracket
259 %type <ttype> template_type template_arg_list template_arg
260 %type <ttype> condition xcond paren_cond_or_null
261 %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
262 %type <ttype> complete_type_name notype_identifier
263 %type <ttype> complex_type_name nested_name_specifier_1
264 %type <itype> nomods_initdecls nomods_initdcl0
265 %type <ttype> new_initializer new_placement
266 %type <ttype> using_decl .poplevel
268 /* in order to recognize aggr tags as defining and thus shadowing. */
269 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
270 %type <ttype> named_class_head_sans_basetype_defn
271 %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
273 %type <ttype> self_template_type
278 /* Used in lex.c for parsing pragmas. */
281 /* lex.c and pt.c depend on this being the last token. Define
282 any new tokens before this one! */
283 %token END_OF_SAVED_INPUT
286 /* List of types and structure classes of the current declaration. */
287 static tree current_declspecs;
288 /* List of prefix attributes in effect.
289 Prefix attributes are parsed by the reserved_declspecs and declmods
290 rules. They create a list that contains *both* declspecs and attrs. */
291 /* ??? It is not clear yet that all cases where an attribute can now appear in
292 a declspec list have been updated. */
293 static tree prefix_attributes;
295 /* When defining an aggregate, this is the most recent one being defined. */
296 static tree current_aggr;
298 /* Tell yyparse how to print a token's value, if yydebug is set. */
300 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
301 extern void yyprint ();
302 extern tree combine_strings PROTO((tree));
310 /* In case there were missing closebraces,
311 get us back to the global binding level. */
312 while (! global_bindings_p ())
318 /* the reason for the strange actions in this rule
319 is so that notype_initdecls when reached via datadef
320 can find a valid list of type and sc specs in $0. */
323 { $<ttype>$ = NULL_TREE; }
325 { $<ttype>$ = NULL_TREE; }
326 | extdefs lang_extdef
327 { $<ttype>$ = NULL_TREE; }
336 { have_extern_spec = 1;
337 used_extern_spec = 0;
338 $<ttype>$ = NULL_TREE; }
341 { have_extern_spec = 0; }
346 { $<itype>$ = pedantic;
356 { if (pending_lang_change) do_pending_lang_change(); }
358 { if (! toplevel_bindings_p () && ! pseudo_global_level_p())
364 { if (pending_inlines) do_pending_inlines (); }
366 { if (pending_inlines) do_pending_inlines (); }
368 { if (pending_inlines) do_pending_inlines (); }
369 | asm_keyword '(' string ')' ';'
370 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
372 | extern_lang_string '{' extdefs_opt '}'
373 { pop_lang_context (); }
374 | extern_lang_string .hush_warning fndef .warning_ok
375 { if (pending_inlines) do_pending_inlines ();
376 pop_lang_context (); }
377 | extern_lang_string .hush_warning datadef .warning_ok
378 { if (pending_inlines) do_pending_inlines ();
379 pop_lang_context (); }
380 | NAMESPACE identifier '{'
381 { push_namespace ($2); }
383 { pop_namespace (); }
385 { push_namespace (NULL_TREE); }
387 { pop_namespace (); }
388 | NAMESPACE identifier '=' any_id ';'
389 { do_namespace_alias ($2, $4); }
391 { do_toplevel_using_decl ($1); }
392 | USING NAMESPACE any_id ';'
394 if (TREE_CODE ($3) == IDENTIFIER_NODE)
396 do_using_directive ($3);
399 { pedantic = $<itype>1; }
405 | USING global_scope qualified_id
407 | USING global_scope unqualified_id
414 | global_scope qualified_id
416 | global_scope unqualified_id
422 { push_lang_context ($1); }
423 | extern_lang_string EXTERN_LANG_STRING
424 { if (current_lang_name != $2)
425 cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
426 pop_lang_context (); push_lang_context ($2); }
431 { begin_template_parm_list (); }
432 template_parm_list '>'
433 { $$ = end_template_parm_list ($4); }
440 { $$ = process_template_parm (NULL_TREE, $1); }
441 | template_parm_list ',' template_parm
442 { $$ = process_template_parm ($1, $3); }
448 $$ = build_tree_list ($1, NULL_TREE);
450 if (TREE_PURPOSE ($$) == signature_type_node)
451 sorry ("signature as template type parameter");
452 else if (TREE_PURPOSE ($$) != class_type_node)
454 pedwarn ("template type parameters must use the keyword `class'");
455 TREE_PURPOSE ($$) = class_type_node;
459 { $$ = build_tree_list ($1, $2); goto ttpa; }
461 { $$ = build_tree_list (class_type_node, NULL_TREE); }
462 | TYPENAME_KEYWORD identifier
463 { $$ = build_tree_list (class_type_node, $2); }
467 /* The following rules introduce a new reduce/reduce
468 conflict on the ',' and '>' input tokens: they are valid
469 prefixes for a `structsp', which means they could match a
470 nameless parameter. See 14.6, paragraph 3.
471 By putting them before the `parm' rule, we get
472 their match before considering them nameless parameter
475 { $$ = build_tree_list (NULL_TREE, $1); }
476 | template_type_parm '=' type_id
477 { $$ = build_tree_list (groktypename ($3.t), $1); }
479 { $$ = build_tree_list (NULL_TREE, $1.t); }
480 | parm '=' expr_no_commas %prec ARITHCOMPARE
481 { $$ = build_tree_list ($3, $1.t); }
487 { end_template_decl (); }
490 { end_template_decl (); }
496 | declmods notype_initdecls ';'
498 | typed_declspecs initdecls ';'
500 note_list_got_semicolon ($1.t);
503 { pedwarn ("empty declaration"); }
504 | explicit_instantiation ';'
505 | typed_declspecs ';'
508 split_specs_attrs ($1.t, &t, &attrs);
510 note_list_got_semicolon ($1.t);
517 ctor_initializer_opt:
536 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
537 { finish_function (lineno, (int)$3, 0); }
538 | fn.def1 maybe_return_init function_try_block
539 { if ($<ttype>$) process_next_inline ($<ttype>$); }
543 constructor_declarator:
544 nested_name_specifier SELFNAME '('
546 $$ = build_parse_node (SCOPE_REF, $1, $2);
547 if ($1 != current_class_type)
549 push_nested_class ($1, 3);
550 TREE_COMPLEXITY ($$) = current_class_depth;
553 parmlist ')' cv_qualifiers exception_specification_opt
554 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
555 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
557 $$ = build_parse_node (SCOPE_REF, $1, $2);
558 if ($1 != current_class_type)
560 push_nested_class ($1, 3);
561 TREE_COMPLEXITY ($$) = current_class_depth;
563 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
565 | global_scope nested_name_specifier SELFNAME '('
567 $$ = build_parse_node (SCOPE_REF, $2, $3);
568 if ($2 != current_class_type)
570 push_nested_class ($2, 3);
571 TREE_COMPLEXITY ($$) = current_class_depth;
574 parmlist ')' cv_qualifiers exception_specification_opt
575 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
576 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
578 $$ = build_parse_node (SCOPE_REF, $2, $3);
579 if ($2 != current_class_type)
581 push_nested_class ($2, 3);
582 TREE_COMPLEXITY ($$) = current_class_depth;
584 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
586 | nested_name_specifier self_template_type '('
588 $$ = build_parse_node (SCOPE_REF, $1, $2);
589 if ($1 != current_class_type)
591 push_nested_class ($1, 3);
592 TREE_COMPLEXITY ($$) = current_class_depth;
595 parmlist ')' cv_qualifiers exception_specification_opt
596 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
597 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
599 $$ = build_parse_node (SCOPE_REF, $1, $2);
600 if ($1 != current_class_type)
602 push_nested_class ($1, 3);
603 TREE_COMPLEXITY ($$) = current_class_depth;
605 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
607 | global_scope nested_name_specifier self_template_type '('
609 $$ = build_parse_node (SCOPE_REF, $2, $3);
610 if ($2 != current_class_type)
612 push_nested_class ($2, 3);
613 TREE_COMPLEXITY ($$) = current_class_depth;
616 parmlist ')' cv_qualifiers exception_specification_opt
617 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
618 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
620 $$ = build_parse_node (SCOPE_REF, $2, $3);
621 if ($2 != current_class_type)
623 push_nested_class ($2, 3);
624 TREE_COMPLEXITY ($$) = current_class_depth;
626 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
631 typed_declspecs declarator
633 split_specs_attrs ($1.t, &specs, &attrs);
634 if (! start_function (specs, $2, attrs, 0))
636 reinit_parse_for_function ();
638 | declmods notype_declarator
640 split_specs_attrs ($1, &specs, &attrs);
641 if (! start_function (specs, $2, attrs, 0))
643 reinit_parse_for_function ();
646 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
648 reinit_parse_for_function ();
650 | declmods constructor_declarator
652 split_specs_attrs ($1, &specs, &attrs);
653 if (! start_function (specs, $2, attrs, 0))
655 reinit_parse_for_function ();
657 | constructor_declarator
658 { if (! start_function (NULL_TREE, $$, NULL_TREE, 0))
660 reinit_parse_for_function ();
664 component_constructor_declarator:
665 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
666 { $$ = make_call_declarator ($1, $3, $5, $6); }
667 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
668 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
669 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
670 { $$ = make_call_declarator ($1, $3, $5, $6); }
671 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
672 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
675 /* more C++ complexity. See component_decl for a comment on the
676 reduce/reduce conflict introduced by these rules. */
678 declmods component_constructor_declarator
679 { tree specs = strip_attrs ($1);
680 $$ = start_method (specs, $2);
684 if (yychar == YYEMPTY)
686 reinit_parse_for_method (yychar, $$); }
687 | component_constructor_declarator
688 { $$ = start_method (NULL_TREE, $1); goto rest_of_mdef; }
689 | typed_declspecs declarator
690 { tree specs = strip_attrs ($1.t);
691 $$ = start_method (specs, $2); goto rest_of_mdef; }
692 | declmods notype_declarator
693 { tree specs = strip_attrs ($1);
694 $$ = start_method (specs, $2); goto rest_of_mdef; }
696 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
697 | declmods constructor_declarator
698 { tree specs = strip_attrs ($1);
699 $$ = start_method (specs, $2); goto rest_of_mdef; }
700 | constructor_declarator
701 { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; }
707 if (! current_function_parms_stored)
715 { store_return_init ($<ttype>$, $2); }
716 | return_id '(' nonnull_exprlist ')'
717 { store_return_init ($<ttype>$, $3); }
718 | return_id LEFT_RIGHT
719 { store_return_init ($<ttype>$, NULL_TREE); }
723 ':' .set_base_init member_init_list
726 error ("no base initializers given following ':'");
728 /* Always keep the BLOCK node associated with the outermost
729 pair of curley braces of a function. These are needed
730 for correct operation of dwarfout.c. */
738 if (! current_function_parms_stored)
741 if (DECL_CONSTRUCTOR_P (current_function_decl))
743 /* Make a contour for the initializer list. */
746 expand_start_bindings (0);
748 else if (current_class_type == NULL_TREE)
749 error ("base initializers not allowed for non-member functions");
750 else if (! DECL_CONSTRUCTOR_P (current_function_decl))
751 error ("only constructors take base initializers");
760 | member_init_list ',' member_init
761 | member_init_list error
765 '(' nonnull_exprlist ')'
767 if (current_class_name)
768 pedwarn ("anachronistic old style base class initializer");
769 expand_member_init (current_class_ref, NULL_TREE, $2);
773 if (current_class_name)
774 pedwarn ("anachronistic old style base class initializer");
775 expand_member_init (current_class_ref, NULL_TREE, void_type_node);
777 | notype_identifier '(' nonnull_exprlist ')'
778 { expand_member_init (current_class_ref, $1, $3); }
779 | notype_identifier LEFT_RIGHT
780 { expand_member_init (current_class_ref, $1, void_type_node); }
781 | complete_type_name '(' nonnull_exprlist ')'
782 { expand_member_init (current_class_ref, $1, $3); }
783 | complete_type_name LEFT_RIGHT
784 { expand_member_init (current_class_ref, $1, void_type_node); }
786 | notype_qualified_id '(' nonnull_exprlist ')'
788 do_member_init (OP0 ($1), OP1 ($1), $3);
790 | notype_qualified_id LEFT_RIGHT
792 do_member_init (OP0 ($1), OP1 ($1), void_type_node);
816 explicit_instantiation:
817 TEMPLATE aggr template_type
818 { do_type_instantiation ($3, NULL_TREE); }
819 | TEMPLATE typed_declspecs declarator
820 { tree specs = strip_attrs ($2.t);
821 do_decl_instantiation (specs, $3, NULL_TREE); }
822 | TEMPLATE notype_declarator
823 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
824 | TEMPLATE constructor_declarator
825 { do_decl_instantiation (NULL_TREE, $2, NULL_TREE); }
826 | SCSPEC TEMPLATE aggr template_type
827 { do_type_instantiation ($4, $1); }
828 | SCSPEC TEMPLATE typed_declspecs declarator
829 { tree specs = strip_attrs ($3.t);
830 do_decl_instantiation (specs, $4, $1); }
831 | SCSPEC TEMPLATE notype_declarator
832 { do_decl_instantiation (NULL_TREE, $3, $1); }
833 | SCSPEC TEMPLATE constructor_declarator
834 { do_decl_instantiation (NULL_TREE, $3, $1); }
837 /* The TYPENAME expansions are to deal with use of a template class name as
838 a template within the class itself, where the template decl is hidden by
839 a type decl. Got all that? */
842 PTYPENAME '<' template_arg_list template_close_bracket
844 $$ = lookup_template_class ($1, $3, NULL_TREE);
845 if ($$ != error_mark_node)
846 $$ = TYPE_STUB_DECL ($$);
848 | PTYPENAME '<' template_close_bracket
850 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
851 if ($$ != error_mark_node)
852 $$ = TYPE_STUB_DECL ($$);
854 | TYPENAME '<' template_arg_list template_close_bracket
856 $$ = lookup_template_class ($1, $3, NULL_TREE);
857 if ($$ != error_mark_node)
858 $$ = TYPE_STUB_DECL ($$);
860 | TYPENAME '<' template_close_bracket
862 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
863 if ($$ != error_mark_node)
864 $$ = TYPE_STUB_DECL ($$);
870 SELFNAME '<' template_arg_list template_close_bracket
872 $$ = lookup_template_class ($1, $3, NULL_TREE);
873 if ($$ != error_mark_node)
874 $$ = TYPE_STUB_DECL ($$);
876 | SELFNAME '<' template_close_bracket
878 $$ = lookup_template_class ($1, NULL_TREE, NULL_TREE);
879 if ($$ != error_mark_node)
880 $$ = TYPE_STUB_DECL ($$);
884 template_close_bracket:
888 /* Handle `Class<Class<Type>>' without space in the `>>' */
889 pedwarn ("`>>' should be `> >' in template class name");
896 { $$ = build_tree_list (NULL_TREE, $$); }
897 | template_arg_list ',' template_arg
898 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
903 { $$ = groktypename ($1.t); }
904 | expr_no_commas %prec ARITHCOMPARE
909 { $$ = NEGATE_EXPR; }
911 { $$ = CONVERT_EXPR; }
913 { $$ = PREINCREMENT_EXPR; }
915 { $$ = PREDECREMENT_EXPR; }
917 { $$ = TRUTH_NOT_EXPR; }
922 { $$ = build_x_compound_expr ($$); }
928 { error ("ANSI C++ forbids an empty condition for `%s'",
930 $$ = integer_zero_node; }
932 { $$ = condition_conversion ($2); }
937 { error ("ANSI C++ forbids an empty condition for `%s'",
939 $$ = integer_zero_node; }
941 { $$ = condition_conversion ($2); }
948 { $$ = condition_conversion ($$); }
954 type_specifier_seq declarator maybeasm maybe_attribute '='
957 for (d = getdecls (); d; d = TREE_CHAIN (d))
958 if (TREE_CODE (d) == TYPE_DECL) {
959 tree s = TREE_TYPE (d);
960 if (TREE_CODE (s) == RECORD_TYPE)
961 cp_error ("definition of class `%T' in condition", s);
962 else if (TREE_CODE (s) == ENUMERAL_TYPE)
963 cp_error ("definition of enum `%T' in condition", s);
966 current_declspecs = $1.t;
967 $<itype>5 = suspend_momentary ();
968 $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1);
969 cplus_decl_attributes ($<ttype>$, $4,
970 /*prefix_attributes*/ NULL_TREE);
974 cp_finish_decl ($<ttype>6, $7, $4, 1, LOOKUP_ONLYCONVERTING);
975 resume_momentary ($<itype>5);
977 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
978 cp_error ("definition of array `%#D' in condition", $$);
985 | maybe_label_decls stmts '}'
986 | maybe_label_decls stmts error '}'
987 | maybe_label_decls error '}'
993 if (processing_template_decl)
995 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
996 COMPOUND_STMT_NO_SCOPE ($<ttype>$) = 1;
997 add_tree ($<ttype>$);
1002 if (processing_template_decl)
1004 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
1005 TREE_CHAIN ($<ttype>2) = NULL_TREE;
1006 last_tree = $<ttype>2;
1014 nontrivial_exprlist:
1015 expr_no_commas ',' expr_no_commas
1016 { $$ = tree_cons (NULL_TREE, $$,
1017 build_tree_list (NULL_TREE, $3)); }
1018 | expr_no_commas ',' error
1019 { $$ = tree_cons (NULL_TREE, $$,
1020 build_tree_list (NULL_TREE, error_mark_node)); }
1021 | nontrivial_exprlist ',' expr_no_commas
1022 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1023 | nontrivial_exprlist ',' error
1024 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1029 { $$ = build_tree_list (NULL_TREE, $$); }
1030 | nontrivial_exprlist
1036 /* __extension__ turns off -pedantic for following primary. */
1037 | extension cast_expr %prec UNARY
1039 pedantic = $<itype>1; }
1040 | '*' cast_expr %prec UNARY
1041 { $$ = build_x_indirect_ref ($2, "unary *"); }
1042 | '&' cast_expr %prec UNARY
1043 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1045 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1046 | unop cast_expr %prec UNARY
1047 { $$ = build_x_unary_op ($1, $2);
1048 if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
1049 TREE_NEGATED_INT ($$) = 1;
1050 overflow_warning ($$);
1052 /* Refer to the address of a label as a pointer. */
1054 { tree label = lookup_label ($2);
1055 if (label == NULL_TREE)
1056 $$ = null_pointer_node;
1059 TREE_USED (label) = 1;
1060 $$ = build1 (ADDR_EXPR, ptr_type_node, label);
1061 TREE_CONSTANT ($$) = 1;
1064 | SIZEOF unary_expr %prec UNARY
1065 { $$ = expr_sizeof ($2); }
1066 | SIZEOF '(' type_id ')' %prec HYPERUNARY
1067 { $$ = c_sizeof (groktypename ($3.t)); }
1068 | ALIGNOF unary_expr %prec UNARY
1069 { $$ = grok_alignof ($2); }
1070 | ALIGNOF '(' type_id ')' %prec HYPERUNARY
1071 { $$ = c_alignof (groktypename ($3.t));
1072 check_for_new_type ("alignof", $3); }
1074 /* The %prec EMPTY's here are required by the = init initializer
1075 syntax extension; see below. */
1076 | new new_type_id %prec EMPTY
1077 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1078 check_for_new_type ("new", $2); }
1079 | new new_type_id new_initializer
1080 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1081 check_for_new_type ("new", $2); }
1082 | new new_placement new_type_id %prec EMPTY
1083 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1084 check_for_new_type ("new", $3); }
1085 | new new_placement new_type_id new_initializer
1086 { $$ = build_new ($2, $3.t, $4, $1);
1087 check_for_new_type ("new", $3); }
1088 | new '(' type_id ')' %prec EMPTY
1089 { $$ = build_new (NULL_TREE, groktypename($3.t),
1091 check_for_new_type ("new", $3); }
1092 | new '(' type_id ')' new_initializer
1093 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1094 check_for_new_type ("new", $3); }
1095 | new new_placement '(' type_id ')' %prec EMPTY
1096 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1097 check_for_new_type ("new", $4); }
1098 | new new_placement '(' type_id ')' new_initializer
1099 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1100 check_for_new_type ("new", $4); }
1102 | delete cast_expr %prec UNARY
1103 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1104 | delete '[' ']' cast_expr %prec UNARY
1105 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1106 if (yychar == YYEMPTY)
1108 | delete '[' expr ']' cast_expr %prec UNARY
1109 { $$ = delete_sanity ($5, $3, 2, $1);
1110 if (yychar == YYEMPTY)
1112 | REALPART cast_expr %prec UNARY
1113 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1114 | IMAGPART cast_expr %prec UNARY
1115 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1119 '(' nonnull_exprlist ')'
1121 | '{' nonnull_exprlist '}'
1124 pedwarn ("old style placement syntax, use () instead");
1129 '(' nonnull_exprlist ')'
1135 cp_error ("`%T' is not a valid expression", $2.t);
1136 $$ = error_mark_node;
1138 /* GNU extension so people can use initializer lists. Note that
1139 this alters the meaning of `new int = 1', which was previously
1140 syntactically valid but semantically invalid. */
1144 pedwarn ("ANSI C++ forbids initialization of new expression with `='");
1149 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1151 '(' type_id ')' %prec EMPTY
1152 { $2.t = tree_cons (NULL_TREE, $2.t, void_list_node);
1153 TREE_PARMLIST ($2.t) = 1;
1154 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1155 check_for_new_type ("cast", $2); }
1156 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1157 { $3.t = tree_cons (NULL_TREE, $3.t, void_list_node);
1158 TREE_PARMLIST ($3.t) = 1;
1159 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1160 check_for_new_type ("cast", $3); }
1165 | regcast_or_absdcl unary_expr %prec UNARY
1166 { $$ = reparse_absdcl_as_casts ($$, $2); }
1167 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1169 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1172 pedwarn ("ANSI C++ forbids constructor-expressions");
1173 /* Indicate that this was a GNU C constructor expression. */
1174 TREE_HAS_CONSTRUCTOR (init) = 1;
1176 $$ = reparse_absdcl_as_casts ($$, init);
1182 /* Handle general members. */
1183 | expr_no_commas POINTSAT_STAR expr_no_commas
1184 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1185 | expr_no_commas DOT_STAR expr_no_commas
1186 { $$ = build_m_component_ref ($$, $3); }
1187 | expr_no_commas '+' expr_no_commas
1188 { $$ = build_x_binary_op ($2, $$, $3); }
1189 | expr_no_commas '-' expr_no_commas
1190 { $$ = build_x_binary_op ($2, $$, $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 LSHIFT expr_no_commas
1198 { $$ = build_x_binary_op ($2, $$, $3); }
1199 | expr_no_commas RSHIFT expr_no_commas
1200 { $$ = build_x_binary_op ($2, $$, $3); }
1201 | expr_no_commas ARITHCOMPARE expr_no_commas
1202 { $$ = build_x_binary_op ($2, $$, $3); }
1203 | expr_no_commas '<' expr_no_commas
1204 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1205 | expr_no_commas '>' expr_no_commas
1206 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1207 | expr_no_commas EQCOMPARE expr_no_commas
1208 { $$ = build_x_binary_op ($2, $$, $3); }
1209 | expr_no_commas MIN_MAX expr_no_commas
1210 { $$ = build_x_binary_op ($2, $$, $3); }
1211 | expr_no_commas '&' expr_no_commas
1212 { $$ = build_x_binary_op ($2, $$, $3); }
1213 | expr_no_commas '|' expr_no_commas
1214 { $$ = build_x_binary_op ($2, $$, $3); }
1215 | expr_no_commas '^' expr_no_commas
1216 { $$ = build_x_binary_op ($2, $$, $3); }
1217 | expr_no_commas ANDAND expr_no_commas
1218 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1219 | expr_no_commas OROR expr_no_commas
1220 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1221 | expr_no_commas '?' xexpr ':' expr_no_commas
1222 { $$ = build_x_conditional_expr ($$, $3, $5); }
1223 | expr_no_commas '=' expr_no_commas
1224 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1225 if ($$ != error_mark_node)
1226 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1227 | expr_no_commas ASSIGN expr_no_commas
1228 { $$ = build_x_modify_expr ($$, $2, $3); }
1230 { $$ = build_throw (NULL_TREE); }
1231 | THROW expr_no_commas
1232 { $$ = build_throw ($2); }
1233 /* These extensions are not defined. The second arg to build_m_component_ref
1234 is old, build_m_component_ref now does an implicit
1235 build_indirect_ref (x, NULL_PTR) on the second argument.
1236 | object '&' expr_no_commas %prec UNARY
1237 { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
1238 | object unop expr_no_commas %prec UNARY
1239 { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
1240 | object '(' type_id ')' expr_no_commas %prec UNARY
1241 { tree type = groktypename ($3.t);
1242 $$ = build_m_component_ref ($$, build_c_cast (type, $5)); }
1243 | object primary_no_id %prec UNARY
1244 { $$ = build_m_component_ref ($$, $2); }
1248 notype_unqualified_id:
1249 '~' see_typename identifier
1250 { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
1254 | NSNAME %prec EMPTY
1258 notype_unqualified_id
1264 notype_unqualified_id
1265 | '*' expr_or_declarator %prec UNARY
1266 { $$ = build_parse_node (INDIRECT_REF, $2); }
1267 | '&' expr_or_declarator %prec UNARY
1268 { $$ = build_parse_node (ADDR_EXPR, $2); }
1269 | '(' expr_or_declarator ')'
1273 direct_notype_declarator:
1274 complex_direct_notype_declarator
1275 | notype_unqualified_id
1276 | '(' expr_or_declarator ')'
1277 { $$ = finish_decl_parsing ($2); }
1281 notype_unqualified_id
1283 if (TREE_CODE ($$) == BIT_NOT_EXPR)
1284 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
1286 $$ = do_identifier ($$, 1);
1292 if (processing_template_decl)
1293 push_obstacks (&permanent_obstack, &permanent_obstack);
1294 $$ = combine_strings ($$);
1295 if (processing_template_decl)
1301 class = TREE_CODE_CLASS (TREE_CODE ($$));
1302 if (class == 'e' || class == '1'
1303 || class == '2' || class == '<')
1304 /* This inhibits warnings in truthvalue_conversion. */
1305 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1306 | '(' expr_or_declarator ')'
1308 $$ = reparse_decl_as_expr (NULL_TREE, $2);
1309 class = TREE_CODE_CLASS (TREE_CODE ($$));
1310 if (class == 'e' || class == '1'
1311 || class == '2' || class == '<')
1312 /* This inhibits warnings in truthvalue_conversion. */
1313 C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
1315 { $$ = error_mark_node; }
1317 { if (current_function_decl == 0)
1319 error ("braced-group within expression allowed only inside a function");
1323 $<ttype>$ = expand_start_stmt_expr (); }
1327 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1328 rtl_exp = expand_end_stmt_expr ($<ttype>2);
1329 /* The statements have side effects, so the group does. */
1330 TREE_SIDE_EFFECTS (rtl_exp) = 1;
1332 if (TREE_CODE ($3) == BLOCK)
1334 /* Make a BIND_EXPR for the BLOCK already made. */
1335 $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
1336 NULL_TREE, rtl_exp, $3);
1337 /* Remove the block from the tree at this point.
1338 It gets put back at the proper place
1339 when the BIND_EXPR is expanded. */
1345 | primary '(' nonnull_exprlist ')'
1347 $$ = build_x_function_call ($1, $3, current_class_ref);
1348 if (TREE_CODE ($$) == CALL_EXPR
1349 && TREE_TYPE ($$) != void_type_node)
1350 $$ = require_complete_type ($$);
1352 | primary LEFT_RIGHT
1354 $$ = build_x_function_call ($$, NULL_TREE, current_class_ref);
1355 if (TREE_CODE ($$) == CALL_EXPR
1356 && TREE_TYPE ($$) != void_type_node)
1357 $$ = require_complete_type ($$);
1359 | primary '[' expr ']'
1360 { $$ = grok_array_decl ($$, $3); }
1362 { /* If we get an OFFSET_REF, turn it into what it really
1363 means (e.g., a COMPONENT_REF). This way if we've got,
1364 say, a reference to a static member that's being operated
1365 on, we don't end up trying to find a member operator for
1366 the class it's in. */
1367 if (TREE_CODE ($$) == OFFSET_REF)
1368 $$ = resolve_offset_ref ($$);
1369 $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1370 | primary MINUSMINUS
1371 { if (TREE_CODE ($$) == OFFSET_REF)
1372 $$ = resolve_offset_ref ($$);
1373 $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1374 /* C++ extensions */
1376 { if (current_class_ptr)
1378 #ifdef WARNING_ABOUT_CCD
1379 TREE_USED (current_class_ptr) = 1;
1381 $$ = current_class_ptr;
1383 else if (current_function_decl
1384 && DECL_STATIC_FUNCTION_P (current_function_decl))
1386 error ("`this' is unavailable for static member functions");
1387 $$ = error_mark_node;
1391 if (current_function_decl)
1392 error ("invalid use of `this' in non-member function");
1394 error ("invalid use of `this' at top level");
1395 $$ = error_mark_node;
1398 | CV_QUALIFIER '(' nonnull_exprlist ')'
1403 /* This is a C cast in C++'s `functional' notation. */
1404 if ($3 == error_mark_node)
1406 $$ = error_mark_node;
1410 if ($3 == NULL_TREE)
1412 error ("cannot cast null list to type `%s'",
1413 IDENTIFIER_POINTER (TYPE_NAME (id)));
1414 $$ = error_mark_node;
1419 /* type is not set! (mrs) */
1420 if (type == error_mark_node)
1421 $$ = error_mark_node;
1425 if (id == ridpointers[(int) RID_CONST])
1426 type = build_type_variant (integer_type_node, 1, 0);
1427 else if (id == ridpointers[(int) RID_VOLATILE])
1428 type = build_type_variant (integer_type_node, 0, 1);
1430 /* should not be able to get here (mrs) */
1431 else if (id == ridpointers[(int) RID_FRIEND])
1433 error ("cannot cast expression to `friend' type");
1434 $$ = error_mark_node;
1438 else my_friendly_abort (79);
1439 $$ = build_c_cast (type, build_compound_expr ($3));
1443 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1444 { tree type = groktypename ($3.t);
1445 check_for_new_type ("dynamic_cast", $3);
1446 $$ = build_dynamic_cast (type, $6); }
1447 | STATIC_CAST '<' type_id '>' '(' expr ')'
1448 { tree type = groktypename ($3.t);
1449 check_for_new_type ("static_cast", $3);
1450 $$ = build_static_cast (type, $6); }
1451 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1452 { tree type = groktypename ($3.t);
1453 check_for_new_type ("reinterpret_cast", $3);
1454 $$ = build_reinterpret_cast (type, $6); }
1455 | CONST_CAST '<' type_id '>' '(' expr ')'
1456 { tree type = groktypename ($3.t);
1457 check_for_new_type ("const_cast", $3);
1458 $$ = build_const_cast (type, $6); }
1459 | TYPEID '(' expr ')'
1460 { $$ = build_x_typeid ($3); }
1461 | TYPEID '(' type_id ')'
1462 { tree type = groktypename ($3.t);
1463 check_for_new_type ("typeid", $3);
1464 $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
1465 | global_scope IDENTIFIER
1466 { $$ = do_scoped_id ($2, 1); }
1467 | global_scope operator_name
1469 got_scope = NULL_TREE;
1470 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1471 $$ = do_scoped_id ($2, 1);
1475 | overqualified_id %prec HYPERUNARY
1476 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1477 | overqualified_id '(' nonnull_exprlist ')'
1478 { if (processing_template_decl)
1479 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, NULL_TREE);
1481 $$ = build_member_call (OP0 ($$), OP1 ($$), $3); }
1482 | overqualified_id LEFT_RIGHT
1483 { if (processing_template_decl)
1484 $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1),
1485 NULL_TREE, NULL_TREE);
1487 $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); }
1488 | object unqualified_id %prec UNARY
1489 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1490 | object overqualified_id %prec UNARY
1491 { if (processing_template_decl)
1492 $$ = build_min_nt (COMPONENT_REF, $1, copy_to_permanent ($2));
1494 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1495 | object unqualified_id '(' nonnull_exprlist ')'
1498 /* This is a future direction of this code, but because
1499 build_x_function_call cannot always undo what is done
1500 in build_component_ref entirely yet, we cannot do this. */
1501 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, current_class_ref);
1502 if (TREE_CODE ($$) == CALL_EXPR
1503 && TREE_TYPE ($$) != void_type_node)
1504 $$ = require_complete_type ($$);
1506 $$ = build_method_call ($$, $2, $4, NULL_TREE,
1510 | object unqualified_id LEFT_RIGHT
1513 /* This is a future direction of this code, but because
1514 build_x_function_call cannot always undo what is done
1515 in build_component_ref entirely yet, we cannot do this. */
1516 $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, current_class_ref);
1517 if (TREE_CODE ($$) == CALL_EXPR
1518 && TREE_TYPE ($$) != void_type_node)
1519 $$ = require_complete_type ($$);
1521 $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
1525 | object overqualified_id '(' nonnull_exprlist ')'
1527 if (IS_SIGNATURE (OP0 ($2)))
1529 warning ("signature name in scope resolution ignored");
1530 $$ = build_method_call ($$, OP1 ($2), $4, NULL_TREE,
1534 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
1536 | object overqualified_id LEFT_RIGHT
1538 if (IS_SIGNATURE (OP0 ($2)))
1540 warning ("signature name in scope resolution ignored");
1541 $$ = build_method_call ($$, OP1 ($2), NULL_TREE, NULL_TREE,
1545 $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), NULL_TREE);
1547 /* p->int::~int() is valid -- 12.4 */
1548 | object '~' TYPESPEC LEFT_RIGHT
1550 if (IDENTIFIER_GLOBAL_VALUE ($3)
1551 && (TREE_CODE (TREE_TYPE ($1))
1552 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
1553 cp_error ("`%E' is not of type `%T'", $1, $3);
1554 $$ = cp_convert (void_type_node, $1);
1556 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1559 cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
1560 if (TREE_CODE (TREE_TYPE ($1))
1561 != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
1562 cp_error ("`%E' is not of type `%T'", $1, $2);
1563 $$ = cp_convert (void_type_node, $1);
1567 $$ = error_mark_node;
1571 /* Not needed for now.
1577 { $$ = error_mark_node; }
1579 { if (current_function_decl == 0)
1581 error ("braced-group within expression allowed only inside a function");
1584 $<ttype>$ = expand_start_stmt_expr (); }
1587 pedwarn ("ANSI C++ forbids braced-groups within expressions");
1588 $$ = expand_end_stmt_expr ($<ttype>2); }
1589 | primary_no_id '(' nonnull_exprlist ')'
1590 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1591 | primary_no_id LEFT_RIGHT
1592 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1593 | primary_no_id '[' expr ']'
1595 | primary_no_id PLUSPLUS
1596 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1597 | primary_no_id MINUSMINUS
1598 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1600 { goto do_scoped_id; }
1601 | SCOPE operator_name
1602 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1604 goto do_scoped_operator;
1613 { got_scope = NULL_TREE; $$ = 1; }
1619 | global_scope delete
1620 { got_scope = NULL_TREE; $$ = 1; }
1625 { $$ = boolean_true_node; }
1627 { $$ = boolean_false_node; }
1630 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1634 { $$ = chainon ($$, $2); }
1640 if (! current_function_parms_stored)
1641 store_parm_decls ();
1643 /* Always keep the BLOCK node associated with the outermost
1644 pair of curley braces of a function. These are needed
1645 for correct operation of dwarfout.c. */
1652 { got_object = TREE_TYPE ($$); }
1655 $$ = build_x_arrow ($$);
1656 got_object = TREE_TYPE ($$);
1661 typespec initdecls ';'
1663 resume_momentary ($2);
1664 if (IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1665 note_got_semicolon ($1.t);
1667 | typed_declspecs initdecls ';'
1669 resume_momentary ($2);
1670 note_list_got_semicolon ($1.t);
1672 | declmods notype_initdecls ';'
1673 { resume_momentary ($2); }
1674 | typed_declspecs ';'
1677 note_list_got_semicolon ($1.t);
1680 { warning ("empty declaration"); }
1682 { pedantic = $<itype>1; }
1685 /* Any kind of declarator (thus, all declarators allowed
1686 after an explicit typespec). */
1689 after_type_declarator %prec EMPTY
1690 | notype_declarator %prec EMPTY
1693 /* This is necessary to postpone reduction of `int()()()()'. */
1695 LEFT_RIGHT %prec EMPTY
1696 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1697 NULL_TREE, NULL_TREE); }
1698 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1699 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1703 /* ANSI type-id (8.1) */
1705 typed_typespecs absdcl
1706 { $$.t = build_decl_list ($1.t, $2);
1707 $$.new_type_flag = $1.new_type_flag; }
1708 | nonempty_cv_qualifiers absdcl
1709 { $$.t = build_decl_list ($1.t, $2);
1710 $$.new_type_flag = $1.new_type_flag; }
1712 { $$.t = build_decl_list (get_decl_list ($1.t), $2);
1713 $$.new_type_flag = $1.new_type_flag; }
1714 | typed_typespecs %prec EMPTY
1715 { $$.t = build_decl_list ($1.t, NULL_TREE);
1716 $$.new_type_flag = $1.new_type_flag; }
1717 | nonempty_cv_qualifiers %prec EMPTY
1718 { $$.t = build_decl_list ($1.t, NULL_TREE);
1719 $$.new_type_flag = $1.new_type_flag; }
1722 /* Declspecs which contain at least one type specifier or typedef name.
1723 (Just `const' or `volatile' is not enough.)
1724 A typedef'd name following these is taken as a name to be declared.
1725 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1728 typed_typespecs %prec EMPTY
1734 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1);
1735 $$.new_type_flag = $2.new_type_flag; }
1736 | typespec reserved_declspecs %prec HYPERUNARY
1737 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1738 $$.new_type_flag = $1.new_type_flag; }
1739 | typespec reserved_typespecquals reserved_declspecs
1740 { $$.t = decl_tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1741 $$.new_type_flag = $1.new_type_flag; }
1742 | declmods typespec reserved_declspecs
1743 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1744 $$.new_type_flag = $2.new_type_flag; }
1745 | declmods typespec reserved_typespecquals
1746 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1));
1747 $$.new_type_flag = $2.new_type_flag; }
1748 | declmods typespec reserved_typespecquals reserved_declspecs
1749 { $$.t = decl_tree_cons (NULL_TREE, $2.t,
1750 chainon ($3, chainon ($4, $1)));
1751 $$.new_type_flag = $2.new_type_flag; }
1756 { if (extra_warnings)
1757 warning ("`%s' is not at beginning of declaration",
1758 IDENTIFIER_POINTER ($$));
1759 $$ = build_decl_list (NULL_TREE, $$); }
1760 | reserved_declspecs typespecqual_reserved
1761 { $$ = decl_tree_cons (NULL_TREE, $2.t, $$); }
1762 | reserved_declspecs SCSPEC
1763 { if (extra_warnings)
1764 warning ("`%s' is not at beginning of declaration",
1765 IDENTIFIER_POINTER ($2));
1766 $$ = decl_tree_cons (NULL_TREE, $2, $$); }
1767 | reserved_declspecs attributes
1768 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1770 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1773 /* List of just storage classes and type modifiers.
1774 A declaration can start with just this, but then it cannot be used
1775 to redeclare a typedef-name.
1776 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1779 nonempty_cv_qualifiers %prec EMPTY
1780 { $$ = $1.t; TREE_STATIC ($$) = 1; }
1782 { $$ = IDENTIFIER_AS_LIST ($$); }
1783 | declmods CV_QUALIFIER
1784 { $$ = decl_tree_cons (NULL_TREE, $2, $$);
1785 TREE_STATIC ($$) = 1; }
1787 { if (extra_warnings && TREE_STATIC ($$))
1788 warning ("`%s' is not at beginning of declaration",
1789 IDENTIFIER_POINTER ($2));
1790 $$ = decl_tree_cons (NULL_TREE, $2, $$);
1791 TREE_STATIC ($$) = TREE_STATIC ($1); }
1792 | declmods attributes
1793 { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
1795 { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
1798 /* Used instead of declspecs where storage classes are not allowed
1799 (that is, for typenames and structure components).
1801 C++ can takes storage classes for structure components.
1802 Don't accept a typedef-name if anything but a modifier precedes it. */
1805 typespec %prec EMPTY
1806 { $$.t = get_decl_list ($1.t);
1807 $$.new_type_flag = $1.new_type_flag; }
1808 | nonempty_cv_qualifiers typespec
1809 { $$.t = decl_tree_cons (NULL_TREE, $2.t, $1.t);
1810 $$.new_type_flag = $2.new_type_flag; }
1811 | typespec reserved_typespecquals
1812 { $$.t = decl_tree_cons (NULL_TREE, $1.t, $2);
1813 $$.new_type_flag = $1.new_type_flag; }
1814 | nonempty_cv_qualifiers typespec reserved_typespecquals
1815 { $$.t = decl_tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1816 $$.new_type_flag = $1.new_type_flag; }
1819 reserved_typespecquals:
1820 typespecqual_reserved
1821 { $$ = build_decl_list (NULL_TREE, $1.t); }
1822 | reserved_typespecquals typespecqual_reserved
1823 { $$ = decl_tree_cons (NULL_TREE, $2.t, $1); }
1826 /* A typespec (but not a type qualifier).
1827 Once we have seen one of these in a declaration,
1828 if a typedef name appears then it is being redeclared. */
1832 | TYPESPEC %prec EMPTY
1833 { $$.t = $1; $$.new_type_flag = 0; }
1834 | complete_type_name
1835 { $$.t = $1; $$.new_type_flag = 0; }
1836 | TYPEOF '(' expr ')'
1837 { $$.t = TREE_TYPE ($3);
1838 $$.new_type_flag = 0; }
1839 | TYPEOF '(' type_id ')'
1840 { $$.t = groktypename ($3.t);
1841 $$.new_type_flag = 0; }
1842 | SIGOF '(' expr ')'
1843 { tree type = TREE_TYPE ($3);
1845 $$.new_type_flag = 0;
1846 if (IS_AGGR_TYPE (type))
1848 sorry ("sigof type specifier");
1853 error ("`sigof' applied to non-aggregate expression");
1854 $$.t = error_mark_node;
1857 | SIGOF '(' type_id ')'
1858 { tree type = groktypename ($3.t);
1860 $$.new_type_flag = 0;
1861 if (IS_AGGR_TYPE (type))
1863 sorry ("sigof type specifier");
1868 error("`sigof' applied to non-aggregate type");
1869 $$.t = error_mark_node;
1874 /* A typespec that is a reserved word, or a type qualifier. */
1876 typespecqual_reserved:
1878 { $$.t = $1; $$.new_type_flag = 0; }
1880 { $$.t = $1; $$.new_type_flag = 0; }
1886 | initdecls ',' initdcl
1891 | notype_initdecls ',' initdcl
1896 | nomods_initdecls ',' initdcl
1902 | asm_keyword '(' string ')'
1903 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
1907 declarator maybeasm maybe_attribute '='
1908 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1909 &prefix_attributes);
1910 if (TREE_CODE (current_declspecs) != TREE_LIST)
1911 current_declspecs = get_decl_list (current_declspecs);
1912 if (have_extern_spec && !used_extern_spec)
1914 current_declspecs = decl_tree_cons
1915 (NULL_TREE, get_identifier ("extern"),
1917 used_extern_spec = 1;
1919 $<itype>4 = suspend_momentary ();
1920 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1921 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1923 /* Note how the declaration of the variable is in effect while its init is parsed! */
1924 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1926 | declarator maybeasm maybe_attribute
1928 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1929 &prefix_attributes);
1930 if (TREE_CODE (current_declspecs) != TREE_LIST)
1931 current_declspecs = get_decl_list (current_declspecs);
1932 if (have_extern_spec && !used_extern_spec)
1934 current_declspecs = decl_tree_cons
1935 (NULL_TREE, get_identifier ("extern"),
1937 used_extern_spec = 1;
1939 $$ = suspend_momentary ();
1940 d = start_decl ($<ttype>1, current_declspecs, 0);
1941 cplus_decl_attributes (d, $3, prefix_attributes);
1942 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1946 declarator maybeasm maybe_attribute '='
1947 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1948 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1950 /* Note how the declaration of the variable is in effect while its init is parsed! */
1951 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING); }
1952 | declarator maybeasm maybe_attribute
1953 { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0);
1954 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes);
1955 cp_finish_decl ($<ttype>$, NULL_TREE, $2, 1, 0); }
1959 notype_declarator maybeasm maybe_attribute '='
1960 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
1961 &prefix_attributes);
1962 $<itype>4 = suspend_momentary ();
1963 $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1);
1964 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1966 /* Note how the declaration of the variable is in effect while its init is parsed! */
1967 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1969 | notype_declarator maybeasm maybe_attribute
1971 split_specs_attrs ($<ttype>0, ¤t_declspecs,
1972 &prefix_attributes);
1973 $$ = suspend_momentary ();
1974 d = start_decl ($<ttype>1, current_declspecs, 0);
1975 cplus_decl_attributes (d, $3, prefix_attributes);
1976 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
1980 notype_declarator maybeasm maybe_attribute '='
1981 { current_declspecs = NULL_TREE;
1982 prefix_attributes = NULL_TREE;
1983 $<itype>4 = suspend_momentary ();
1984 $<ttype>$ = start_decl ($1, current_declspecs, 1);
1985 cplus_decl_attributes ($<ttype>$, $3, prefix_attributes); }
1987 /* Note how the declaration of the variable is in effect while its init is parsed! */
1988 { cp_finish_decl ($<ttype>5, $6, $2, 1, LOOKUP_ONLYCONVERTING);
1990 | notype_declarator maybeasm maybe_attribute
1992 current_declspecs = NULL_TREE;
1993 prefix_attributes = NULL_TREE;
1994 $$ = suspend_momentary ();
1995 d = start_decl ($1, current_declspecs, 0);
1996 cplus_decl_attributes (d, $3, prefix_attributes);
1997 cp_finish_decl (d, NULL_TREE, $2, 1, 0); }
2000 /* the * rules are dummies to accept the Apollo extended syntax
2001 so that the header files compile. */
2012 | attributes attribute
2013 { $$ = chainon ($1, $2); }
2017 ATTRIBUTE '(' '(' attribute_list ')' ')'
2024 | attribute_list ',' attrib
2025 { $$ = chainon ($1, $3); }
2032 { $$ = build_tree_list ($1, NULL_TREE); }
2033 | any_word '(' IDENTIFIER ')'
2034 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2035 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2036 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2037 | any_word '(' nonnull_exprlist ')'
2038 { $$ = build_tree_list ($1, $3); }
2041 /* This still leaves out most reserved keywords,
2042 shouldn't we include them? */
2051 /* A nonempty list of identifiers, including typenames. */
2052 identifiers_or_typenames:
2054 { $$ = build_tree_list (NULL_TREE, $1); }
2055 | identifiers_or_typenames ',' identifier
2056 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2060 /* empty */ %prec EMPTY
2065 /* If we are processing a template, we don't want to expand this
2069 expr_no_commas %prec '='
2071 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2072 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2074 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2075 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2076 | '{' initlist ',' '}'
2077 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2078 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2083 /* This chain is built in reverse order,
2084 and put in forward order where initlist is used. */
2087 { $$ = build_tree_list (NULL_TREE, $$); }
2089 { $$ = tree_cons (NULL_TREE, $3, $$); }
2090 /* These are for labeled elements. */
2091 | '[' expr_no_commas ']' init
2092 { $$ = build_tree_list ($2, $4); }
2093 | initlist ',' CASE expr_no_commas ':' init
2094 { $$ = tree_cons ($4, $6, $$); }
2095 | identifier ':' init
2096 { $$ = build_tree_list ($$, $3); }
2097 | initlist ',' identifier ':' init
2098 { $$ = tree_cons ($3, $5, $$); }
2102 PRE_PARSED_FUNCTION_DECL
2103 { start_function (NULL_TREE, TREE_VALUE ($1),
2105 reinit_parse_for_function (); }
2109 | pending_inlines fn.defpen maybe_return_init ctor_initializer_opt
2112 int nested = (hack_decl_function_context
2113 (current_function_decl) != NULL_TREE);
2114 finish_function (lineno, (int)$4, nested);
2115 process_next_inline ($2);
2117 | pending_inlines fn.defpen maybe_return_init function_try_block
2118 { process_next_inline ($2); }
2124 { $<itype>3 = suspend_momentary ();
2125 $<ttype>$ = start_enum ($2); }
2126 enumlist maybecomma_warn '}'
2127 { $$.t = finish_enum ($<ttype>4, $5);
2128 $$.new_type_flag = 1;
2129 resume_momentary ((int) $<itype>3);
2130 check_for_missing_semicolon ($<ttype>4); }
2131 | ENUM identifier '{' '}'
2132 { $$.t = finish_enum (start_enum ($2), NULL_TREE);
2133 $$.new_type_flag = 1;
2134 check_for_missing_semicolon ($$.t); }
2136 { $<itype>2 = suspend_momentary ();
2137 $<ttype>$ = start_enum (make_anon_name ()); }
2138 enumlist maybecomma_warn '}'
2139 { $$.t = finish_enum ($<ttype>3, $4);
2140 resume_momentary ((int) $<itype>1);
2141 check_for_missing_semicolon ($<ttype>3);
2142 $$.new_type_flag = 1; }
2144 { $$.t = finish_enum (start_enum (make_anon_name()), NULL_TREE);
2145 $$.new_type_flag = 1;
2146 check_for_missing_semicolon ($$.t); }
2148 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2149 $$.new_type_flag = 0; }
2150 | ENUM complex_type_name
2151 { $$.t = xref_tag (enum_type_node, $2, NULL_TREE, 1);
2152 $$.new_type_flag = 0; }
2153 | TYPENAME_KEYWORD nested_name_specifier identifier
2154 { $$.t = make_typename_type ($2, $3);
2155 $$.new_type_flag = 0; }
2156 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2157 { $$.t = make_typename_type ($3, $4);
2158 $$.new_type_flag = 0; }
2159 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2160 | class_head left_curly opt.component_decl_list '}' maybe_attribute
2167 /* Need to rework class nesting in the
2168 presence of nested classes, etc. */
2169 shadow_tag (CLASSTYPE_AS_LIST ($1)); */
2171 if (yychar == YYEMPTY)
2173 semi = yychar == ';';
2174 /* finish_struct nukes this anyway; if
2175 finish_exception does too, then it can go. */
2177 note_got_semicolon ($1);
2179 if (TREE_CODE ($1) == ENUMERAL_TYPE)
2183 $<ttype>$ = finish_struct ($1, $3, $5, semi);
2184 if (semi) note_got_semicolon ($<ttype>$);
2190 check_for_missing_semicolon ($1);
2192 && current_scope () == current_function_decl)
2193 do_pending_inlines ();
2197 $$.new_type_flag = 1; }
2198 | class_head %prec EMPTY
2201 $$.new_type_flag = 0;
2202 /* struct B: public A; is not accepted by the WP grammar. */
2203 if (TYPE_BINFO_BASETYPES ($$.t) && !TYPE_SIZE ($$.t)
2204 && ! TYPE_BEING_DEFINED ($$.t))
2205 cp_error ("base clause without member specification for `%#T'",
2218 { if (pedantic && !in_system_header)
2219 pedwarn ("comma at end of enumerator list"); }
2225 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2227 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2229 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2231 { error ("no body nor ';' separates two class, struct or union declarations"); }
2234 named_class_head_sans_basetype:
2236 { current_aggr = $$; $$ = $2; }
2239 named_class_head_sans_basetype_defn:
2240 aggr identifier_defn %prec EMPTY
2241 { current_aggr = $$; $$ = $2; }
2244 named_complex_class_head_sans_basetype:
2245 aggr nested_name_specifier identifier
2248 if (TREE_CODE ($3) == TYPE_DECL)
2252 cp_error ("`%T' does not have a nested type named `%D'",
2255 (current_aggr, make_anon_name (), NULL_TREE, 1);
2256 $$ = TYPE_MAIN_DECL ($$);
2259 | aggr template_type
2260 { current_aggr = $$; $$ = $2; }
2261 | aggr nested_name_specifier template_type
2262 { current_aggr = $$; $$ = $3; }
2266 /* empty */ %prec EMPTY
2267 { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
2271 named_class_head_sans_basetype %prec EMPTY
2272 { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
2273 | named_class_head_sans_basetype_defn do_xref_defn
2274 maybe_base_class_list %prec EMPTY
2278 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2280 | named_complex_class_head_sans_basetype maybe_base_class_list
2282 $$ = TREE_TYPE ($1);
2283 if (TREE_INT_CST_LOW (current_aggr) == union_type
2284 && TREE_CODE ($$) != UNION_TYPE)
2285 cp_pedwarn ("`union' tag used in declaring `%#T'", $$);
2286 else if (TREE_CODE ($$) == UNION_TYPE
2287 && TREE_INT_CST_LOW (current_aggr) != union_type)
2288 cp_pedwarn ("non-`union' tag used in declaring `%#T'", $$);
2291 if (IS_AGGR_TYPE ($$) && CLASSTYPE_USE_TEMPLATE ($$))
2293 if (CLASSTYPE_IMPLICIT_INSTANTIATION ($$)
2294 && TYPE_SIZE ($$) == NULL_TREE)
2296 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION ($$);
2297 if (processing_template_decl)
2298 push_template_decl (TYPE_MAIN_DECL ($$));
2300 else if (CLASSTYPE_TEMPLATE_INSTANTIATION ($$))
2301 cp_error ("specialization after instantiation of `%T'", $$);
2303 xref_basetypes (current_aggr, $1, $$, $2);
2310 { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
2311 yyungetc ('{', 1); }
2319 maybe_base_class_list:
2320 /* empty */ %prec EMPTY
2322 | ':' see_typename %prec EMPTY
2323 { yyungetc(':', 1); $$ = NULL_TREE; }
2324 | ':' see_typename base_class_list %prec EMPTY
2330 | base_class_list ',' see_typename base_class
2331 { $$ = chainon ($$, $4); }
2337 tree type = TREE_TYPE ($1);
2338 if (! is_aggr_type (type, 1))
2340 else if (current_aggr == signature_type_node
2341 && (! type) && (! IS_SIGNATURE (type)))
2343 error ("class name not allowed as base signature");
2346 else if (current_aggr == signature_type_node)
2348 sorry ("signature inheritance, base type `%s' ignored",
2349 IDENTIFIER_POINTER ($$));
2350 $$ = build_tree_list (access_public_node, type);
2352 else if (type && IS_SIGNATURE (type))
2354 error ("signature name not allowed as base class");
2358 $$ = build_tree_list (access_default_node, type);
2360 | base_class_access_list see_typename base_class.1
2362 tree type = TREE_TYPE ($3);
2363 if (current_aggr == signature_type_node)
2364 error ("access and source specifiers not allowed in signature");
2365 if (! IS_AGGR_TYPE (type))
2367 else if (current_aggr == signature_type_node
2368 && (! type) && (! IS_SIGNATURE (type)))
2370 error ("class name not allowed as base signature");
2373 else if (current_aggr == signature_type_node)
2375 sorry ("signature inheritance, base type `%s' ignored",
2376 IDENTIFIER_POINTER ($$));
2377 $$ = build_tree_list (access_public_node, type);
2379 else if (type && IS_SIGNATURE (type))
2381 error ("signature name not allowed as base class");
2385 $$ = build_tree_list ($$, type);
2391 | TYPENAME_KEYWORD nested_name_specifier identifier
2392 { $$ = TYPE_MAIN_DECL (make_typename_type ($2, $3)); }
2393 | TYPENAME_KEYWORD global_scope nested_name_specifier identifier
2394 { $$ = TYPE_MAIN_DECL (make_typename_type ($3, $4)); }
2395 | SIGOF '(' expr ')'
2397 if (current_aggr == signature_type_node)
2399 if (IS_AGGR_TYPE (TREE_TYPE ($3)))
2401 sorry ("`sigof' as base signature specifier");
2402 $$ = TREE_TYPE ($3);
2406 error ("`sigof' applied to non-aggregate expression");
2407 $$ = error_mark_node;
2412 error ("`sigof' in struct or class declaration");
2413 $$ = error_mark_node;
2416 | SIGOF '(' type_id ')'
2418 if (current_aggr == signature_type_node)
2420 if (IS_AGGR_TYPE (groktypename ($3.t)))
2422 sorry ("`sigof' as base signature specifier");
2423 $$ = groktypename ($3.t);
2427 error ("`sigof' applied to non-aggregate expression");
2428 $$ = error_mark_node;
2433 error ("`sigof' in struct or class declaration");
2434 $$ = error_mark_node;
2439 base_class_access_list:
2440 VISSPEC see_typename
2441 | SCSPEC see_typename
2442 { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
2443 sorry ("non-virtual access");
2444 $$ = access_default_virtual_node; }
2445 | base_class_access_list VISSPEC see_typename
2447 if ($2 == access_protected_node)
2449 warning ("`protected' access not implemented");
2450 $2 = access_public_node;
2453 else if ($2 == access_public_node)
2455 if ($1 == access_private_node)
2458 error ("base class cannot be public and private");
2460 else if ($1 == access_default_virtual_node)
2461 $$ = access_public_virtual_node;
2463 else /* $2 == access_private_node */
2465 if ($1 == access_public_node)
2467 else if ($1 == access_default_virtual_node)
2468 $$ = access_private_virtual_node;
2471 | base_class_access_list SCSPEC see_typename
2472 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2473 sorry ("non-virtual access");
2474 if ($$ == access_public_node)
2475 $$ = access_public_virtual_node;
2476 else if ($$ == access_private_node)
2477 $$ = access_private_virtual_node; }
2482 { tree t = $<ttype>0;
2483 push_obstacks_nochange ();
2484 end_temporary_allocation ();
2486 if (t == error_mark_node
2487 || ! IS_AGGR_TYPE (t))
2489 t = $<ttype>0 = make_lang_type (RECORD_TYPE);
2490 pushtag (make_anon_name (), t, 0);
2493 duplicate_tag_error (t);
2494 if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
2496 t = make_lang_type (TREE_CODE (t));
2497 pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
2500 if (processing_template_decl && TYPE_CONTEXT (t)
2501 && ! current_class_type)
2502 push_template_decl (TYPE_STUB_DECL (t));
2504 TYPE_BEING_DEFINED (t) = 1;
2505 if (IS_AGGR_TYPE (t) && CLASSTYPE_USE_TEMPLATE (t))
2507 if (CLASSTYPE_IMPLICIT_INSTANTIATION (t)
2508 && TYPE_SIZE (t) == NULL_TREE)
2510 SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
2511 if (processing_template_decl)
2512 push_template_decl (TYPE_MAIN_DECL (t));
2514 else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
2515 cp_error ("specialization after instantiation of `%T'", t);
2517 /* Reset the interface data, at the earliest possible
2518 moment, as it might have been set via a class foo;
2520 /* Don't change signatures. */
2521 if (! IS_SIGNATURE (t))
2523 extern tree pending_vtables;
2525 tree name = TYPE_IDENTIFIER (t);
2527 if (! ANON_AGGRNAME_P (name))
2529 CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
2530 SET_CLASSTYPE_INTERFACE_UNKNOWN_X
2531 (t, interface_unknown);
2534 /* Record how to set the access of this class's
2535 virtual functions. If write_virtuals == 2 or 3, then
2536 inline virtuals are ``extern inline''. */
2537 switch (write_virtuals)
2544 needs_writing = !! value_member (name, pending_vtables);
2547 needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
2548 && CLASSTYPE_INTERFACE_KNOWN (t);
2553 CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
2556 t = TYPE_IDENTIFIER ($<ttype>0);
2557 if (t && IDENTIFIER_TEMPLATE (t))
2558 overload_template_name (t, 1);
2566 $$ = build_self_reference ();
2570 opt.component_decl_list:
2572 { if ($$) $$ = build_tree_list (access_public_node, $$); }
2573 | self_reference component_decl_list
2575 if (current_aggr == signature_type_node)
2576 $$ = build_tree_list (access_public_node, $2);
2578 $$ = build_tree_list (access_default_node, $2);
2579 if ($1) $$ = tree_cons (access_public_node, $1, $$);
2581 | opt.component_decl_list VISSPEC ':' component_decl_list
2585 if (current_aggr == signature_type_node)
2587 error ("access specifier not allowed in signature");
2588 visspec = access_public_node;
2590 $$ = chainon ($$, build_tree_list (visspec, $4));
2592 | opt.component_decl_list VISSPEC ':'
2594 if (current_aggr == signature_type_node)
2595 error ("access specifier not allowed in signature");
2599 /* Note: we no longer warn about the semicolon after a component_decl_list.
2600 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2601 component_decl_list:
2603 { if ($$ == void_type_node) $$ = NULL_TREE;
2605 | component_decl_list component_decl
2606 { /* In pushdecl, we created a reverse list of names
2607 in this binding level. Make sure that the chain
2608 of what we're trying to add isn't the item itself
2609 (which can happen with what pushdecl's doing). */
2610 if ($2 != NULL_TREE && $2 != void_type_node)
2612 if (TREE_CHAIN ($2) != $$)
2613 $$ = chainon ($$, $2);
2621 component_decl_1 ';'
2623 | component_decl_1 '}'
2624 { error ("missing ';' before right brace");
2625 yyungetc ('}', 0); }
2626 /* C++: handle constructors, destructors and inline functions */
2627 /* note that INLINE is like a TYPESPEC */
2628 | fn.def2 ':' /* base_init compstmt */
2629 { $$ = finish_method ($$); }
2630 | fn.def2 TRY /* base_init compstmt */
2631 { $$ = finish_method ($$); }
2632 | fn.def2 RETURN /* base_init compstmt */
2633 { $$ = finish_method ($$); }
2634 | fn.def2 '{' /* nodecls compstmt */
2635 { $$ = finish_method ($$); }
2638 | extension component_decl
2640 pedantic = $<itype>1; }
2644 /* Do not add a "typed_declspecs declarator" rule here for
2645 speed; we need to call grok_x_components for enums, so the
2646 speedup would be insignificant. */
2647 typed_declspecs components
2648 { $$ = grok_x_components ($1.t, $2); }
2649 | declmods notype_components
2650 { $$ = grok_x_components ($1, $2); }
2651 | notype_declarator maybeasm maybe_attribute maybe_init
2652 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2653 build_tree_list ($3, NULL_TREE)); }
2654 | constructor_declarator maybeasm maybe_attribute maybe_init
2655 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2656 build_tree_list ($3, NULL_TREE)); }
2657 | ':' expr_no_commas
2658 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2662 /* These rules introduce a reduce/reduce conflict; in
2663 typedef int foo, bar;
2667 should "A::foo" be declared as a function or "A::bar" as a data
2668 member? In other words, is "bar" an after_type_declarator or a
2670 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2671 { tree specs, attrs;
2672 split_specs_attrs ($1, &specs, &attrs);
2673 $$ = grokfield ($2, specs, $5, $3,
2674 build_tree_list ($4, attrs)); }
2675 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2676 { $$ = grokfield ($$, NULL_TREE, $4, $2,
2677 build_tree_list ($3, NULL_TREE)); }
2679 { $$ = do_class_using_decl ($1); }
2682 /* The case of exactly one component is handled directly by component_decl. */
2685 /* empty: possibly anonymous */
2687 | component_declarator0
2688 | components ',' component_declarator
2690 /* In this context, void_type_node encodes
2691 friends. They have been recorded elsewhere. */
2692 if ($$ == void_type_node)
2695 $$ = chainon ($$, $3);
2700 /* empty: possibly anonymous */
2702 | notype_component_declarator0
2703 | notype_components ',' notype_component_declarator
2705 /* In this context, void_type_node encodes
2706 friends. They have been recorded elsewhere. */
2707 if ($$ == void_type_node)
2710 $$ = chainon ($$, $3);
2714 component_declarator0:
2715 after_type_component_declarator0
2716 | notype_component_declarator0
2719 component_declarator:
2720 after_type_component_declarator
2721 | notype_component_declarator
2724 after_type_component_declarator0:
2725 after_type_declarator maybeasm maybe_attribute maybe_init
2726 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2727 &prefix_attributes);
2728 $<ttype>0 = current_declspecs;
2729 $$ = grokfield ($$, current_declspecs, $4, $2,
2730 build_tree_list ($3, prefix_attributes)); }
2731 | TYPENAME ':' expr_no_commas maybe_attribute
2732 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2733 &prefix_attributes);
2734 $<ttype>0 = current_declspecs;
2735 $$ = grokbitfield ($$, current_declspecs, $3);
2736 cplus_decl_attributes ($$, $4, prefix_attributes); }
2739 notype_component_declarator0:
2740 notype_declarator maybeasm maybe_attribute maybe_init
2741 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2742 &prefix_attributes);
2743 $<ttype>0 = current_declspecs;
2744 $$ = grokfield ($$, current_declspecs, $4, $2,
2745 build_tree_list ($3, prefix_attributes)); }
2746 | constructor_declarator maybeasm maybe_attribute maybe_init
2747 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2748 &prefix_attributes);
2749 $<ttype>0 = current_declspecs;
2750 $$ = grokfield ($$, current_declspecs, $4, $2,
2751 build_tree_list ($3, prefix_attributes)); }
2752 | IDENTIFIER ':' expr_no_commas maybe_attribute
2753 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2754 &prefix_attributes);
2755 $<ttype>0 = current_declspecs;
2756 $$ = grokbitfield ($$, current_declspecs, $3);
2757 cplus_decl_attributes ($$, $4, prefix_attributes); }
2758 | ':' expr_no_commas maybe_attribute
2759 { split_specs_attrs ($<ttype>0, ¤t_declspecs,
2760 &prefix_attributes);
2761 $<ttype>0 = current_declspecs;
2762 $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2763 cplus_decl_attributes ($$, $3, prefix_attributes); }
2766 after_type_component_declarator:
2767 after_type_declarator maybeasm maybe_attribute maybe_init
2768 { $$ = grokfield ($$, current_declspecs, $4, $2,
2769 build_tree_list ($3, prefix_attributes)); }
2770 | TYPENAME ':' expr_no_commas maybe_attribute
2771 { $$ = grokbitfield ($$, current_declspecs, $3);
2772 cplus_decl_attributes ($$, $4, prefix_attributes); }
2775 notype_component_declarator:
2776 notype_declarator maybeasm maybe_attribute maybe_init
2777 { $$ = grokfield ($$, current_declspecs, $4, $2,
2778 build_tree_list ($3, prefix_attributes)); }
2779 | IDENTIFIER ':' expr_no_commas maybe_attribute
2780 { $$ = grokbitfield ($$, current_declspecs, $3);
2781 cplus_decl_attributes ($$, $4, prefix_attributes); }
2782 | ':' expr_no_commas maybe_attribute
2783 { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
2784 cplus_decl_attributes ($$, $3, prefix_attributes); }
2787 /* We chain the enumerators in reverse order.
2788 Because of the way enums are built, the order is
2789 insignificant. Take advantage of this fact. */
2793 | enumlist ',' enumerator
2794 { TREE_CHAIN ($3) = $$; $$ = $3; }
2799 { $$ = build_enumerator ($$, NULL_TREE); }
2800 | identifier '=' expr_no_commas
2801 { $$ = build_enumerator ($$, $3); }
2804 /* ANSI new-type-id (5.3.4) */
2806 type_specifier_seq new_declarator
2807 { $$.t = build_decl_list ($1.t, $2);
2808 $$.new_type_flag = $1.new_type_flag; }
2809 | type_specifier_seq %prec EMPTY
2810 { $$.t = build_decl_list ($1.t, NULL_TREE);
2811 $$.new_type_flag = $1.new_type_flag; }
2812 /* GNU extension to allow arrays of arbitrary types with
2813 non-constant dimension. */
2814 | '(' type_id ')' '[' expr ']'
2817 pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
2818 $$.t = build_parse_node (ARRAY_REF, TREE_VALUE ($2.t), $5);
2819 $$.t = build_decl_list (TREE_PURPOSE ($2.t), $$.t);
2820 $$.new_type_flag = $2.new_type_flag;
2825 /* empty */ %prec EMPTY
2827 | cv_qualifiers CV_QUALIFIER
2828 { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
2831 nonempty_cv_qualifiers:
2833 { $$.t = IDENTIFIER_AS_LIST ($1);
2834 $$.new_type_flag = 0; }
2835 | nonempty_cv_qualifiers CV_QUALIFIER
2836 { $$.t = decl_tree_cons (NULL_TREE, $2, $1.t);
2837 $$.new_type_flag = $1.new_type_flag; }
2840 /* These rules must follow the rules for function declarations
2841 and component declarations. That way, longer rules are preferred. */
2845 { $<itype>$ = suspend_momentary (); }
2847 /* An expression which will not live on the momentary obstack. */
2850 { resume_momentary ((int) $<itype>1); $$ = $2; }
2853 /* An expression which will not live on the momentary obstack. */
2855 suspend_mom '(' nonnull_exprlist ')'
2856 { resume_momentary ((int) $<itype>1); $$ = $3; }
2857 | suspend_mom '(' parmlist ')'
2858 { resume_momentary ((int) $<itype>1); $$ = $3; }
2859 | suspend_mom LEFT_RIGHT
2860 { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
2861 | suspend_mom '(' error ')'
2862 { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
2865 /* A declarator that is allowed only after an explicit typespec. */
2866 /* may all be followed by prec '.' */
2867 after_type_declarator:
2868 '*' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2869 { $$ = make_pointer_declarator ($2.t, $3); }
2870 | '&' nonempty_cv_qualifiers after_type_declarator %prec UNARY
2871 { $$ = make_reference_declarator ($2.t, $3); }
2872 | '*' after_type_declarator %prec UNARY
2873 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2874 | '&' after_type_declarator %prec UNARY
2875 { $$ = make_reference_declarator (NULL_TREE, $2); }
2876 | ptr_to_mem cv_qualifiers after_type_declarator
2877 { tree arg = make_pointer_declarator ($2, $3);
2878 $$ = build_parse_node (SCOPE_REF, $1, arg);
2880 | direct_after_type_declarator
2884 type_name %prec EMPTY
2886 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2888 if (current_class_type
2889 && TYPE_BEING_DEFINED (current_class_type)
2890 && ! IDENTIFIER_CLASS_VALUE ($1))
2892 /* Be sure to get an inherited typedef. */
2893 $$ = lookup_name ($1, 1);
2894 /* Remember that this name has been used in the class
2895 definition, as per [class.scope0] */
2896 pushdecl_class_level ($$);
2899 $$ = identifier_typedecl_value ($1);
2904 | global_scope type_name
2906 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2907 $$ = identifier_typedecl_value ($2);
2910 got_scope = NULL_TREE;
2913 | global_scope nested_type
2918 nested_name_specifier type_name %prec EMPTY
2919 { $$ = get_type_decl ($2); }
2922 direct_after_type_declarator:
2923 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2924 { $$ = make_call_declarator ($$, $2, $3, $4); }
2925 | direct_after_type_declarator '[' nonmomentary_expr ']'
2926 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2927 | direct_after_type_declarator '[' ']'
2928 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2929 | '(' after_type_declarator ')'
2931 | nested_name_specifier type_name %prec EMPTY
2932 { push_nested_class ($1, 3);
2933 $$ = build_parse_node (SCOPE_REF, $$, $2);
2934 TREE_COMPLEXITY ($$) = current_class_depth; }
2935 | type_name %prec EMPTY
2938 /* A declarator allowed whether or not there has been
2939 an explicit typespec. These cannot redeclare a typedef-name. */
2942 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2943 { $$ = make_pointer_declarator ($2.t, $3); }
2944 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2945 { $$ = make_reference_declarator ($2.t, $3); }
2946 | '*' notype_declarator %prec UNARY
2947 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2948 | '&' notype_declarator %prec UNARY
2949 { $$ = make_reference_declarator (NULL_TREE, $2); }
2950 | ptr_to_mem cv_qualifiers notype_declarator
2951 { tree arg = make_pointer_declarator ($2, $3);
2952 $$ = build_parse_node (SCOPE_REF, $1, arg);
2954 | direct_notype_declarator
2957 complex_notype_declarator:
2958 '*' nonempty_cv_qualifiers notype_declarator %prec UNARY
2959 { $$ = make_pointer_declarator ($2.t, $3); }
2960 | '&' nonempty_cv_qualifiers notype_declarator %prec UNARY
2961 { $$ = make_reference_declarator ($2.t, $3); }
2962 | '*' complex_notype_declarator %prec UNARY
2963 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2964 | '&' complex_notype_declarator %prec UNARY
2965 { $$ = make_reference_declarator (NULL_TREE, $2); }
2966 | ptr_to_mem cv_qualifiers notype_declarator
2967 { tree arg = make_pointer_declarator ($2, $3);
2968 $$ = build_parse_node (SCOPE_REF, $1, arg);
2970 | complex_direct_notype_declarator
2973 complex_direct_notype_declarator:
2974 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2975 { $$ = make_call_declarator ($$, $2, $3, $4); }
2976 | '(' complex_notype_declarator ')'
2978 | direct_notype_declarator '[' nonmomentary_expr ']'
2979 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
2980 | direct_notype_declarator '[' ']'
2981 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
2982 | notype_qualified_id
2983 { if (OP0 ($$) != current_class_type)
2985 push_nested_class (OP0 ($$), 3);
2986 TREE_COMPLEXITY ($$) = current_class_depth;
2992 nested_name_specifier unqualified_id
2993 { got_scope = NULL_TREE;
2994 $$ = build_parse_node (SCOPE_REF, $$, $2); }
2997 notype_qualified_id:
2998 nested_name_specifier notype_unqualified_id
2999 { got_scope = NULL_TREE;
3000 $$ = build_parse_node (SCOPE_REF, $$, $2); }
3005 | global_scope notype_qualified_id
3010 typespec '(' nonnull_exprlist ')'
3011 { $$ = build_functional_cast ($1.t, $3); }
3012 | typespec '(' expr_or_declarator ')'
3013 { $$ = reparse_decl_as_expr ($1.t, $3); }
3014 | typespec fcast_or_absdcl %prec EMPTY
3015 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3021 | template_type %prec EMPTY
3024 nested_name_specifier:
3025 nested_name_specifier_1
3026 | nested_name_specifier nested_name_specifier_1
3030 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3031 inline here?!? (jason) */
3032 nested_name_specifier_1:
3035 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3038 /* Remember that this name has been used in the class
3039 definition, as per [class.scope0] */
3040 if (current_class_type
3041 && TYPE_BEING_DEFINED (current_class_type)
3042 && ! IDENTIFIER_CLASS_VALUE ($1))
3043 pushdecl_class_level ($$);
3045 got_scope = $$ = TREE_TYPE ($$);
3049 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3051 got_scope = $$ = TREE_TYPE ($$);
3055 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3057 if (TREE_CODE ($$) == NAMESPACE_DECL
3058 && DECL_NAME ($$) == get_identifier ("std"))
3059 got_scope = void_type_node;
3063 | template_type SCOPE
3064 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3065 /* These break 'const i;'
3069 cp_error ("`%D' is not an aggregate typedef",
3070 lastiddecl ? lastiddecl : $$);
3071 $$ = error_mark_node;
3074 { goto failed_scope; } */
3078 global_scope type_name
3080 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3081 $$ = identifier_typedecl_value ($2);
3084 got_scope = NULL_TREE;
3087 | global_scope nested_type
3092 nested_name_specifier '*'
3093 { got_scope = NULL_TREE; }
3094 | global_scope nested_name_specifier '*'
3095 { $$ = $2; got_scope = NULL_TREE; }
3098 /* All uses of explicit global scope must go through this nonterminal so
3099 that got_scope will be set before yylex is called to get the next token. */
3102 { got_scope = void_type_node; }
3105 /* ANSI new-declarator (5.3.4) */
3107 '*' cv_qualifiers new_declarator
3108 { $$ = make_pointer_declarator ($2, $3); }
3109 | '*' cv_qualifiers %prec EMPTY
3110 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3111 | '&' cv_qualifiers new_declarator %prec EMPTY
3112 { $$ = make_reference_declarator ($2, $3); }
3113 | '&' cv_qualifiers %prec EMPTY
3114 { $$ = make_reference_declarator ($2, NULL_TREE); }
3115 | ptr_to_mem cv_qualifiers %prec EMPTY
3116 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3117 $$ = build_parse_node (SCOPE_REF, $1, arg);
3119 | ptr_to_mem cv_qualifiers new_declarator
3120 { tree arg = make_pointer_declarator ($2, $3);
3121 $$ = build_parse_node (SCOPE_REF, $1, arg);
3123 | direct_new_declarator %prec EMPTY
3126 /* ANSI direct-new-declarator (5.3.4) */
3127 direct_new_declarator:
3129 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3130 | direct_new_declarator '[' nonmomentary_expr ']'
3131 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3134 /* ANSI abstract-declarator (8.1) */
3136 '*' nonempty_cv_qualifiers absdcl
3137 { $$ = make_pointer_declarator ($2.t, $3); }
3139 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3140 | '*' nonempty_cv_qualifiers %prec EMPTY
3141 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3143 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3144 | '&' nonempty_cv_qualifiers absdcl
3145 { $$ = make_reference_declarator ($2.t, $3); }
3147 { $$ = make_reference_declarator (NULL_TREE, $2); }
3148 | '&' nonempty_cv_qualifiers %prec EMPTY
3149 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3151 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3152 | ptr_to_mem cv_qualifiers %prec EMPTY
3153 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3154 $$ = build_parse_node (SCOPE_REF, $1, arg);
3156 | ptr_to_mem cv_qualifiers absdcl
3157 { tree arg = make_pointer_declarator ($2, $3);
3158 $$ = build_parse_node (SCOPE_REF, $1, arg);
3160 | direct_abstract_declarator %prec EMPTY
3163 /* ANSI direct-abstract-declarator (8.1) */
3164 direct_abstract_declarator:
3167 /* `(typedef)1' is `int'. */
3169 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3170 { $$ = make_call_declarator ($$, $3, $5, $6); }
3171 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3172 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3173 | direct_abstract_declarator '[' nonmomentary_expr ']' %prec '.'
3174 { $$ = build_parse_node (ARRAY_REF, $$, $3); }
3175 | direct_abstract_declarator '[' ']' %prec '.'
3176 { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
3177 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3178 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3179 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3180 { set_quals_and_spec ($$, $2, $3); }
3181 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3182 { set_quals_and_spec ($$, $2, $3); }
3183 | '[' nonmomentary_expr ']' %prec '.'
3184 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
3186 { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
3189 /* For C++, decls and stmts can be intermixed, so we don't need to
3190 have a special rule that won't start parsing the stmt section
3191 until we have a stmt that parses without errors. */
3204 /* build the LET_STMT node before parsing its contents,
3205 so that any LET_STMTs within the context can have their display pointers
3206 set up to point at this one. */
3210 { do_pushlevel (); }
3215 { $$ = do_poplevel (); }
3218 /* Read zero or more forward-declarations for labels
3219 that nested functions can jump to. */
3224 pedwarn ("ANSI C++ forbids label declarations"); }
3229 | label_decls label_decl
3233 LABEL identifiers_or_typenames ';'
3235 for (link = $2; link; link = TREE_CHAIN (link))
3237 tree label = shadow_label (TREE_VALUE (link));
3238 C_DECLARED_LABEL_FLAG (label) = 1;
3239 declare_nonlocal_label (label);
3244 /* This is the body of a function definition.
3245 It causes syntax errors to ignore to the next openbrace. */
3255 if (processing_template_decl)
3257 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3258 add_tree ($<ttype>$);
3261 .pushlevel compstmtend .poplevel
3263 if (processing_template_decl)
3265 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3266 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3267 last_tree = $<ttype>2;
3276 if (processing_template_decl)
3278 $<ttype>$ = build_min_nt (IF_STMT, NULL_TREE, NULL_TREE,
3280 add_tree ($<ttype>$);
3282 cond_stmt_keyword = "if";
3284 .pushlevel paren_cond_or_null
3286 if (processing_template_decl)
3288 if (last_tree != $<ttype>2)
3290 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3291 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3292 last_tree = $<ttype>2;
3295 TREE_OPERAND ($<ttype>2, 0) = $4;
3299 emit_line_note (input_filename, lineno);
3300 expand_start_cond ($4, 0);
3303 implicitly_scoped_stmt
3305 if (processing_template_decl)
3307 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3308 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3309 $<ttype>$ = last_tree = $<ttype>2;
3314 implicitly_scoped_stmt:
3319 if (processing_template_decl)
3321 $<ttype>$ = build_min_nt (COMPOUND_STMT, NULL_TREE);
3322 add_tree ($<ttype>$);
3325 simple_stmt .poplevel
3327 if (processing_template_decl)
3329 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3330 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3331 last_tree = $<ttype>2;
3349 if (! processing_template_decl)
3351 emit_line_note (input_filename, lineno);
3352 /* Do default conversion if safe and possibly important,
3353 in case within ({...}). */
3354 if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
3356 || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
3357 expr = default_conversion (expr);
3359 cplus_expand_expr_stmt (expr);
3363 { if (! processing_template_decl) expand_start_else (); }
3364 implicitly_scoped_stmt
3366 if (processing_template_decl)
3368 TREE_OPERAND ($<ttype>1, 2) = TREE_CHAIN ($<ttype>1);
3369 TREE_CHAIN ($<ttype>1) = NULL_TREE;
3370 last_tree = $<ttype>1;
3377 | simple_if %prec IF
3378 { if (! processing_template_decl) expand_end_cond ();
3383 if (processing_template_decl)
3385 $<ttype>$ = build_min_nt (WHILE_STMT, NULL_TREE, NULL_TREE);
3386 add_tree ($<ttype>$);
3391 emit_line_note (input_filename, lineno);
3392 expand_start_loop (1);
3394 cond_stmt_keyword = "while";
3396 .pushlevel paren_cond_or_null
3398 if (processing_template_decl)
3400 if (last_tree != $<ttype>2)
3402 TREE_OPERAND ($<ttype>2, 0) = last_tree;
3403 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3404 last_tree = $<ttype>2;
3407 TREE_OPERAND ($<ttype>2, 0) = $4;
3411 emit_line_note (input_filename, lineno);
3412 expand_exit_loop_if_false (0, $4);
3415 already_scoped_stmt .poplevel
3417 if (processing_template_decl)
3419 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3420 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3421 last_tree = $<ttype>2;
3429 if (processing_template_decl)
3431 $<ttype>$ = build_min_nt (DO_STMT, NULL_TREE, NULL_TREE);
3432 add_tree ($<ttype>$);
3437 emit_line_note (input_filename, lineno);
3438 expand_start_loop_continue_elsewhere (1);
3441 implicitly_scoped_stmt WHILE
3443 if (processing_template_decl)
3445 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3446 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3447 last_tree = $<ttype>2;
3451 expand_loop_continue_here ();
3452 cond_stmt_keyword = "do";
3455 paren_expr_or_null ';'
3457 if (processing_template_decl)
3458 TREE_OPERAND ($<ttype>2, 1) = $6;
3461 emit_line_note (input_filename, lineno);
3462 expand_exit_loop_if_false (0, $6);
3469 { if (processing_template_decl)
3471 $<ttype>$ = build_min_nt (FOR_STMT, NULL_TREE, NULL_TREE,
3472 NULL_TREE, NULL_TREE);
3473 add_tree ($<ttype>$);
3476 emit_line_note (input_filename, lineno);
3477 if (flag_new_for_scope > 0)
3479 /* Conditionalize .pushlevel */
3481 note_level_for_for ();
3484 expand_start_bindings (0);
3487 '(' for.init.statement
3489 if (processing_template_decl)
3491 if (last_tree != $<ttype>2)
3493 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3494 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3495 last_tree = $<ttype>2;
3501 emit_line_note (input_filename, lineno);
3502 expand_start_loop_continue_elsewhere (1);
3505 .pushlevel xcond ';'
3507 if (processing_template_decl)
3509 if (last_tree != $<ttype>2)
3511 TREE_OPERAND ($<ttype>2, 1) = last_tree;
3512 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3513 last_tree = $<ttype>2;
3516 TREE_OPERAND ($<ttype>2, 1) = $7;
3520 emit_line_note (input_filename, lineno);
3521 if ($7) expand_exit_loop_if_false (0, $7);
3525 /* Don't let the tree nodes for $10 be discarded
3526 by clear_momentary during the parsing of the next stmt. */
3528 if (processing_template_decl)
3529 TREE_OPERAND ($<ttype>2, 2) = $10;
3532 already_scoped_stmt .poplevel
3534 if (processing_template_decl)
3536 TREE_OPERAND ($<ttype>2, 3) = TREE_CHAIN ($<ttype>2);
3537 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3538 last_tree = $<ttype>2;
3542 emit_line_note (input_filename, lineno);
3543 expand_loop_continue_here ();
3544 if ($10) cplus_expand_expr_stmt ($10);
3548 if (flag_new_for_scope > 0)
3553 | SWITCH .pushlevel '(' condition ')'
3555 if (processing_template_decl)
3557 $<ttype>$ = build_min_nt (SWITCH_STMT, $4, NULL_TREE);
3558 add_tree ($<ttype>$);
3562 emit_line_note (input_filename, lineno);
3563 c_expand_start_case ($4);
3566 /* Don't let the tree nodes for $4 be discarded by
3567 clear_momentary during the parsing of the next stmt. */
3570 implicitly_scoped_stmt
3572 if (processing_template_decl)
3574 TREE_OPERAND ($<ttype>6, 1) = TREE_CHAIN ($<ttype>6);
3575 TREE_CHAIN ($<ttype>6) = NULL_TREE;
3576 last_tree = $<ttype>6;
3579 expand_end_case ($4);
3585 | CASE expr_no_commas ':'
3586 { do_case ($2, NULL_TREE); }
3588 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3589 { do_case ($2, $4); }
3592 { do_case (NULL_TREE, NULL_TREE); }
3595 { emit_line_note (input_filename, lineno);
3596 if (processing_template_decl)
3597 add_tree (build_min_nt (BREAK_STMT));
3598 else if ( ! expand_exit_something ())
3599 error ("break statement not within loop or switch"); }
3601 { emit_line_note (input_filename, lineno);
3602 if (processing_template_decl)
3603 add_tree (build_min_nt (CONTINUE_STMT));
3604 else if (! expand_continue_loop (0))
3605 error ("continue statement not within a loop"); }
3607 { emit_line_note (input_filename, lineno);
3608 c_expand_return (NULL_TREE); }
3610 { emit_line_note (input_filename, lineno);
3611 c_expand_return ($2);
3614 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3615 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3616 emit_line_note (input_filename, lineno);
3620 /* This is the case with just output operands. */
3621 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3622 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3623 emit_line_note (input_filename, lineno);
3624 c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
3625 $2 == ridpointers[(int)RID_VOLATILE],
3626 input_filename, lineno);
3629 /* This is the case with input operands as well. */
3630 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
3631 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3632 emit_line_note (input_filename, lineno);
3633 c_expand_asm_operands ($4, $6, $8, NULL_TREE,
3634 $2 == ridpointers[(int)RID_VOLATILE],
3635 input_filename, lineno);
3638 /* This is the case with clobbered registers as well. */
3639 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3640 asm_operands ':' asm_clobbers ')' ';'
3641 { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
3642 emit_line_note (input_filename, lineno);
3643 c_expand_asm_operands ($4, $6, $8, $10,
3644 $2 == ridpointers[(int)RID_VOLATILE],
3645 input_filename, lineno);
3650 if (processing_template_decl)
3651 add_tree (build_min_nt (GOTO_STMT, $3));
3653 { emit_line_note (input_filename, lineno);
3654 expand_computed_goto ($3); }
3656 | GOTO identifier ';'
3658 if (processing_template_decl)
3659 add_tree (build_min_nt (GOTO_STMT, $2));
3663 emit_line_note (input_filename, lineno);
3664 decl = lookup_label ($2);
3665 TREE_USED (decl) = 1;
3672 { error ("label must be followed by statement");
3683 if (! current_function_parms_stored)
3684 store_parm_decls ();
3685 expand_start_early_try_stmts ();
3687 ctor_initializer_opt compstmt_or_error
3688 { expand_start_all_catch (); }
3691 int nested = (hack_decl_function_context
3692 (current_function_decl) != NULL_TREE);
3693 expand_end_all_catch ();
3694 finish_function (lineno, (int)$3, nested);
3701 if (processing_template_decl)
3703 $<ttype>$ = build_min_nt (TRY_BLOCK, NULL_TREE,
3705 add_tree ($<ttype>$);
3709 emit_line_note (input_filename, lineno);
3710 expand_start_try_stmts ();
3715 if (processing_template_decl)
3717 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3718 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3719 last_tree = $<ttype>2;
3722 expand_start_all_catch ();
3726 if (processing_template_decl)
3728 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3729 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3730 last_tree = $<ttype>2;
3733 expand_end_all_catch ();
3739 | handler_seq handler
3745 if (processing_template_decl)
3747 $<ttype>$ = build_min_nt (HANDLER, NULL_TREE,
3749 add_tree ($<ttype>$);
3752 .pushlevel handler_args
3754 if (processing_template_decl)
3756 TREE_OPERAND ($<ttype>2, 0) = TREE_CHAIN ($<ttype>2);
3757 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3758 last_tree = $<ttype>2;
3763 if (processing_template_decl)
3765 TREE_OPERAND ($<ttype>2, 1) = TREE_CHAIN ($<ttype>2);
3766 TREE_CHAIN ($<ttype>2) = NULL_TREE;
3767 last_tree = $<ttype>2;
3770 expand_end_catch_block ();
3776 typed_typespecs %prec EMPTY
3777 | nonempty_cv_qualifiers %prec EMPTY
3782 { expand_start_catch_block (NULL_TREE, NULL_TREE); }
3783 /* This doesn't allow reference parameters, the below does.
3784 | '(' type_specifier_seq absdcl ')'
3785 { check_for_new_type ("inside exception declarations", $2);
3786 expand_start_catch_block ($2.t, $3); }
3787 | '(' type_specifier_seq ')'
3788 { check_for_new_type ("inside exception declarations", $2);
3789 expand_start_catch_block ($2.t, NULL_TREE); }
3790 | '(' type_specifier_seq notype_declarator ')'
3791 { check_for_new_type ("inside exception declarations", $2);
3792 expand_start_catch_block ($2.t, $3); }
3793 | '(' typed_typespecs after_type_declarator ')'
3794 { check_for_new_type ("inside exception declarations", $2);
3795 expand_start_catch_block ($2.t, $3); }
3796 This allows reference parameters... */
3798 { check_for_new_type ("inside exception declarations", $2);
3799 expand_start_catch_block (TREE_PURPOSE ($2.t),
3800 TREE_VALUE ($2.t)); }
3807 label = define_label (input_filename, lineno, $1);
3808 if (label && ! minimal_parse_mode)
3809 expand_label (label);
3821 { if ($1) cplus_expand_expr_stmt ($1); }
3825 pedwarn ("ANSI C++ forbids compound statements inside for initializations");
3829 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3833 { emit_line_note (input_filename, lineno);
3836 { emit_line_note (input_filename, lineno); }
3847 /* These are the operands other than the first string and colon
3848 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3852 | nonnull_asm_operands
3855 nonnull_asm_operands:
3857 | nonnull_asm_operands ',' asm_operand
3858 { $$ = chainon ($$, $3); }
3863 { $$ = build_tree_list ($$, $3); }
3868 { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
3869 | asm_clobbers ',' STRING
3870 { $$ = tree_cons (NULL_TREE, $3, $$); }
3873 /* This is what appears inside the parens in a function declarator.
3874 Its value is represented in the format that grokdeclarator expects.
3876 In C++, declaring a function with no parameters
3877 means that that function takes *no* parameters. */
3886 { $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3887 TREE_PARMLIST ($$) = 1;
3888 check_for_new_type ("inside parameter list", $1); }
3891 /* This nonterminal does not include the common sequence '(' type_id ')',
3892 as it is ambiguous and must be disambiguated elsewhere. */
3896 $$ = chainon ($$, void_list_node);
3897 TREE_PARMLIST ($$) = 1;
3899 | parms_comma ELLIPSIS
3901 TREE_PARMLIST ($$) = 1;
3903 /* C++ allows an ellipsis without a separating ',' */
3906 TREE_PARMLIST ($$) = 1;
3910 $$ = build_tree_list (NULL_TREE, $1.t);
3911 TREE_PARMLIST ($$) = 1;
3919 TREE_PARMLIST ($$) = 1;
3921 | parms TYPENAME_ELLIPSIS
3923 TREE_PARMLIST ($$) = 1;
3925 | type_id TYPENAME_ELLIPSIS
3927 $$ = build_tree_list (NULL_TREE, $1.t);
3928 TREE_PARMLIST ($$) = 1;
3932 /* This helps us recover from really nasty
3933 parse errors, for example, a missing right
3935 yyerror ("possibly missing ')'");
3936 $$ = chainon ($$, void_list_node);
3937 TREE_PARMLIST ($$) = 1;
3943 /* This helps us recover from really nasty
3944 parse errors, for example, a missing right
3946 yyerror ("possibly missing ')'");
3947 $$ = tree_cons (NULL_TREE, $1.t, void_list_node);
3948 TREE_PARMLIST ($$) = 1;
3954 /* A nonempty list of parameter declarations or type names. */
3957 { check_for_new_type ("in a parameter list", $1);
3958 $$ = build_tree_list (NULL_TREE, $1.t); }
3960 { check_for_new_type ("in a parameter list", $1);
3961 $$ = build_tree_list ($3, $1.t); }
3962 | parms_comma full_parm
3963 { check_for_new_type ("in a parameter list", $2);
3964 $$ = chainon ($$, $2.t); }
3965 | parms_comma bad_parm
3966 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
3967 | parms_comma bad_parm '=' init
3968 { $$ = chainon ($$, build_tree_list ($4, $2)); }
3974 { check_for_new_type ("in a parameter list", $1);
3975 $$ = build_tree_list (NULL_TREE, $1.t); }
3978 /* A single parameter declaration or parameter type name,
3979 as found in a parmlist. */
3981 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3982 TYPESPEC IDENTIFIER. */
3983 typed_declspecs1 declarator
3984 { tree specs = strip_attrs ($1.t);
3985 $$.new_type_flag = $1.new_type_flag;
3986 $$.t = build_tree_list (specs, $2); }
3987 | typed_typespecs declarator
3988 { $$.t = build_tree_list ($1.t, $2);
3989 $$.new_type_flag = $1.new_type_flag; }
3990 | typespec declarator
3991 { $$.t = build_tree_list (get_decl_list ($1.t), $2);
3992 $$.new_type_flag = $1.new_type_flag; }
3993 | typed_declspecs1 absdcl
3994 { tree specs = strip_attrs ($1.t);
3995 $$.t = build_tree_list (specs, $2);
3996 $$.new_type_flag = $1.new_type_flag; }
3997 | typed_declspecs1 %prec EMPTY
3998 { tree specs = strip_attrs ($1.t);
3999 $$.t = build_tree_list (specs, NULL_TREE);
4000 $$.new_type_flag = $1.new_type_flag; }
4001 | declmods notype_declarator
4002 { tree specs = strip_attrs ($1);
4003 $$.t = build_tree_list (specs, $2);
4004 $$.new_type_flag = 0; }
4009 { $$.t = build_tree_list ($2, $1.t);
4010 $$.new_type_flag = $1.new_type_flag; }
4019 /* empty */ %prec EMPTY
4020 { see_typename (); }
4024 /* empty */ %prec EMPTY
4026 error ("type specifier omitted for parameter");
4027 $$ = build_tree_list (integer_type_node, NULL_TREE);
4031 error ("type specifier omitted for parameter");
4032 if (TREE_CODE ($$) == SCOPE_REF
4033 && TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM)
4034 cp_error (" perhaps you want `typename %E' to make it a type", $$);
4035 $$ = build_tree_list (integer_type_node, $$);
4039 exception_specification_opt:
4040 /* empty */ %prec EMPTY
4042 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
4044 | THROW LEFT_RIGHT %prec EMPTY
4045 { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
4048 ansi_raise_identifier:
4050 { $$ = build_decl_list (NULL_TREE, groktypename($1.t)); }
4053 ansi_raise_identifiers:
4054 ansi_raise_identifier
4055 | ansi_raise_identifiers ',' ansi_raise_identifier
4057 TREE_CHAIN ($3) = $$;
4062 conversion_declarator:
4063 /* empty */ %prec EMPTY
4065 | '*' cv_qualifiers conversion_declarator
4066 { $$ = make_pointer_declarator ($2, $3); }
4067 | '&' cv_qualifiers conversion_declarator
4068 { $$ = make_reference_declarator ($2, $3); }
4069 | ptr_to_mem cv_qualifiers conversion_declarator
4070 { tree arg = make_pointer_declarator ($2, $3);
4071 $$ = build_parse_node (SCOPE_REF, $1, arg);
4077 { got_scope = NULL_TREE; }
4082 { $$ = ansi_opname[MULT_EXPR]; }
4084 { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
4086 { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
4088 { $$ = ansi_opname[PLUS_EXPR]; }
4090 { $$ = ansi_opname[MINUS_EXPR]; }
4092 { $$ = ansi_opname[BIT_AND_EXPR]; }
4094 { $$ = ansi_opname[BIT_IOR_EXPR]; }
4096 { $$ = ansi_opname[BIT_XOR_EXPR]; }
4098 { $$ = ansi_opname[BIT_NOT_EXPR]; }
4100 { $$ = ansi_opname[COMPOUND_EXPR]; }
4101 | operator ARITHCOMPARE
4102 { $$ = ansi_opname[$2]; }
4104 { $$ = ansi_opname[LT_EXPR]; }
4106 { $$ = ansi_opname[GT_EXPR]; }
4107 | operator EQCOMPARE
4108 { $$ = ansi_opname[$2]; }
4110 { $$ = ansi_assopname[$2]; }
4112 { $$ = ansi_opname [MODIFY_EXPR]; }
4114 { $$ = ansi_opname[$2]; }
4116 { $$ = ansi_opname[$2]; }
4118 { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
4119 | operator MINUSMINUS
4120 { $$ = ansi_opname[PREDECREMENT_EXPR]; }
4122 { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
4124 { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
4126 { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
4128 { $$ = ansi_opname[COND_EXPR]; }
4130 { $$ = ansi_opname[$2]; }
4131 | operator POINTSAT %prec EMPTY
4132 { $$ = ansi_opname[COMPONENT_REF]; }
4133 | operator POINTSAT_STAR %prec EMPTY
4134 { $$ = ansi_opname[MEMBER_REF]; }
4135 | operator LEFT_RIGHT
4136 { $$ = ansi_opname[CALL_EXPR]; }
4138 { $$ = ansi_opname[ARRAY_REF]; }
4139 | operator NEW %prec EMPTY
4140 { $$ = ansi_opname[NEW_EXPR]; }
4141 | operator DELETE %prec EMPTY
4142 { $$ = ansi_opname[DELETE_EXPR]; }
4143 | operator NEW '[' ']'
4144 { $$ = ansi_opname[VEC_NEW_EXPR]; }
4145 | operator DELETE '[' ']'
4146 { $$ = ansi_opname[VEC_DELETE_EXPR]; }
4147 /* Names here should be looked up in class scope ALSO. */
4148 | operator type_specifier_seq conversion_declarator
4149 { $$ = grokoptypename ($2.t, $3); }
4151 { $$ = ansi_opname[ERROR_MARK]; }
4158 debug_yytranslate (value)
4161 return yytname[YYTRANSLATE (value)];