1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001 Free Software Foundation, Inc.
4 Hacked by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* This grammar is based on the GNU CC grammar. */
26 /* Note: Bison automatically applies a default action of "$$ = $1" for
27 all derivations; this is applied before the explicit action, if one
28 is given. Keep this in mind when reading the actions. */
31 /* Cause the `yydebug' variable to be defined. */
48 /* Since parsers are distinct for each language, put the language string
49 definition here. (fnf) */
50 const char * const language_string = "GNU C++";
52 extern struct obstack permanent_obstack;
54 /* Like YYERROR but do call yyerror. */
55 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
57 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
58 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
60 /* Contains the statement keyword (if/while/do) to include in an
61 error message if the user supplies an empty conditional expression. */
62 static const char *cond_stmt_keyword;
64 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
68 /* List of types and structure classes of the current declaration. */
69 static tree current_declspecs;
71 /* List of prefix attributes in effect.
72 Prefix attributes are parsed by the reserved_declspecs and declmods
73 rules. They create a list that contains *both* declspecs and attrs. */
74 /* ??? It is not clear yet that all cases where an attribute can now appear in
75 a declspec list have been updated. */
76 static tree prefix_attributes;
78 /* When defining an enumeration, this is the type of the enumeration. */
79 static tree current_enum_type;
81 /* When parsing a conversion operator name, this is the scope of the
83 static tree saved_scopes;
85 static tree empty_parms PARAMS ((void));
86 static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int));
87 static tree parse_decl PARAMS ((tree, tree, int));
88 static void parse_end_decl PARAMS ((tree, tree, tree));
89 static tree parse_field0 PARAMS ((tree, tree, tree, tree, tree, tree));
90 static tree parse_field PARAMS ((tree, tree, tree, tree));
91 static tree parse_bitfield0 PARAMS ((tree, tree, tree, tree, tree));
92 static tree parse_bitfield PARAMS ((tree, tree, tree));
93 static tree parse_method PARAMS ((tree, tree, tree));
94 static void frob_specs PARAMS ((tree, tree));
96 /* Cons up an empty parameter list. */
102 #ifndef NO_IMPLICIT_EXTERN_C
103 if (in_system_header && current_class_type == NULL
104 && current_lang_name == lang_name_c)
108 parms = void_list_node;
112 /* Record the decl-specifiers, attributes and type lookups from the
113 decl-specifier-seq in a declaration. */
116 frob_specs (specs_attrs, lookups)
117 tree specs_attrs, lookups;
119 save_type_access_control (lookups);
120 split_specs_attrs (specs_attrs, ¤t_declspecs, &prefix_attributes);
121 if (current_declspecs
122 && TREE_CODE (current_declspecs) != TREE_LIST)
123 current_declspecs = build_tree_list (NULL_TREE, current_declspecs);
124 if (have_extern_spec && !used_extern_spec)
126 current_declspecs = tree_cons (NULL_TREE,
127 get_identifier ("extern"),
129 used_extern_spec = 1;
134 parse_decl (declarator, attributes, initialized)
135 tree declarator, attributes;
138 return start_decl (declarator, current_declspecs, initialized,
139 attributes, prefix_attributes);
143 parse_decl0 (declarator, specs_attrs, lookups, attributes, initialized)
144 tree declarator, specs_attrs, lookups, attributes;
147 frob_specs (specs_attrs, lookups);
148 return parse_decl (declarator, attributes, initialized);
152 parse_end_decl (decl, init, asmspec)
153 tree decl, init, asmspec;
155 /* If decl is NULL_TREE, then this was a variable declaration using
156 () syntax for the initializer, so we handled it in grokdeclarator. */
158 decl_type_access_control (decl);
159 cp_finish_decl (decl, init, asmspec, init ? LOOKUP_ONLYCONVERTING : 0);
163 parse_field (declarator, attributes, asmspec, init)
164 tree declarator, attributes, asmspec, init;
166 tree d = grokfield (declarator, current_declspecs, init, asmspec,
167 chainon (attributes, prefix_attributes));
168 decl_type_access_control (d);
173 parse_field0 (declarator, specs_attrs, lookups, attributes, asmspec, init)
174 tree declarator, specs_attrs, lookups, attributes, asmspec, init;
176 frob_specs (specs_attrs, lookups);
177 return parse_field (declarator, attributes, asmspec, init);
181 parse_bitfield (declarator, attributes, width)
182 tree declarator, attributes, width;
184 tree d = grokbitfield (declarator, current_declspecs, width);
185 cplus_decl_attributes (&d, chainon (attributes, prefix_attributes), 0);
186 decl_type_access_control (d);
191 parse_bitfield0 (declarator, specs_attrs, lookups, attributes, width)
192 tree declarator, specs_attrs, lookups, attributes, width;
194 frob_specs (specs_attrs, lookups);
195 return parse_bitfield (declarator, attributes, width);
199 parse_method (declarator, specs_attrs, lookups)
200 tree declarator, specs_attrs, lookups;
203 frob_specs (specs_attrs, lookups);
204 d = start_method (current_declspecs, declarator, prefix_attributes);
205 decl_type_access_control (d);
212 ggc_add_tree_root (¤t_declspecs, 1);
213 ggc_add_tree_root (&prefix_attributes, 1);
214 ggc_add_tree_root (¤t_enum_type, 1);
215 ggc_add_tree_root (&saved_scopes, 1);
218 /* Rename the "yyparse" function so that we can override it elsewhere. */
219 #define yyparse yyparse_1
229 flagged_type_tree ftype;
230 struct unparsed_text *pi;
233 /* All identifiers that are not reserved words
234 and are not declared typedefs in the current block */
237 /* All identifiers that are declared typedefs in the current block.
238 In some contexts, they are treated just like IDENTIFIER,
239 but they can also serve as typespecs in declarations. */
243 /* A template function. */
246 /* Reserved words that specify storage class.
247 yylval contains an IDENTIFIER_NODE which indicates which one. */
250 /* Reserved words that specify type.
251 yylval contains an IDENTIFIER_NODE which indicates which one. */
254 /* Reserved words that qualify type: "const" or "volatile".
255 yylval contains an IDENTIFIER_NODE which indicates which one. */
258 /* Character or numeric constants.
259 yylval is the node for the constant. */
262 /* __func__, __FUNCTION__ or __PRETTY_FUNCTION__.
263 yylval contains an IDENTIFIER_NODE which indicates which one. */
266 /* String constants in raw form.
267 yylval is a STRING_CST node. */
270 /* "...", used for functions with variable arglists. */
273 /* the reserved words */
274 /* SCO include files test "ASM", so use something else. */
275 %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
276 %token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
278 %token ATTRIBUTE EXTENSION LABEL
279 %token REALPART IMAGPART VA_ARG
281 /* the reserved words... C++ extensions */
283 %token <ttype> VISSPEC
284 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
285 %token NAMESPACE TYPENAME_KEYWORD USING
286 %token LEFT_RIGHT TEMPLATE
287 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
290 /* Define the operator tokens and their precedences.
291 The value is an integer because, if used, it is the tree code
292 to use in the expression made from the operator. */
294 %left EMPTY /* used to resolve s/r with epsilon */
298 /* Add precedence rules to solve dangling else s/r conflict */
302 %left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
308 %right <code> ASSIGN '='
316 %left <code> EQCOMPARE
317 %left <code> ARITHCOMPARE '<' '>'
318 %left <code> LSHIFT RSHIFT
320 %left <code> '*' '/' '%'
321 %left <code> POINTSAT_STAR DOT_STAR
322 %right <code> UNARY PLUSPLUS MINUSMINUS '~'
324 %left <ttype> LEFT_RIGHT
325 %left <code> POINTSAT '.' '(' '['
327 %right SCOPE /* C++ extension */
328 %nonassoc NEW DELETE TRY CATCH
332 %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
333 %type <ttype> PFUNCNAME maybe_identifier
334 %type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
335 %type <ttype> expr_no_commas expr_no_comma_rangle
336 %type <ttype> cast_expr unary_expr primary string STRING
337 %type <ttype> reserved_declspecs boolean.literal
338 %type <ttype> reserved_typespecquals
339 %type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
340 %type <ttype> init initlist maybeasm maybe_init defarg defarg1
341 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
342 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
343 %type <ttype> any_word
345 %type <itype> save_lineno
346 %type <ttype> simple_stmt simple_if
348 %type <ttype> declarator notype_declarator after_type_declarator
349 %type <ttype> notype_declarator_intern absdcl_intern
350 %type <ttype> after_type_declarator_intern
351 %type <ttype> direct_notype_declarator direct_after_type_declarator
352 %type <itype> components notype_components
353 %type <ttype> component_decl component_decl_1
354 %type <ttype> component_declarator component_declarator0
355 %type <ttype> notype_component_declarator notype_component_declarator0
356 %type <ttype> after_type_component_declarator after_type_component_declarator0
357 %type <ttype> absdcl cv_qualifiers
358 %type <ttype> direct_abstract_declarator conversion_declarator
359 %type <ttype> new_declarator direct_new_declarator
360 %type <ttype> xexpr parmlist parms bad_parm
361 %type <ttype> identifiers_or_typenames
362 %type <ttype> fcast_or_absdcl regcast_or_absdcl
363 %type <ttype> expr_or_declarator expr_or_declarator_intern
364 %type <ttype> complex_notype_declarator
365 %type <ttype> notype_unqualified_id unqualified_id qualified_id
366 %type <ttype> template_id do_id object_template_id notype_template_declarator
367 %type <ttype> overqualified_id notype_qualified_id any_id
368 %type <ttype> complex_direct_notype_declarator functional_cast
369 %type <ttype> complex_parmlist parms_comma
370 %type <ttype> namespace_qualifier namespace_using_decl
372 %type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
373 %type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
374 %type <ftype> structsp typespecqual_reserved parm named_parm full_parm
375 %type <ftype> declmods
377 %type <itype> extension
380 %token <ttype> PTYPENAME
381 %token <ttype> EXTERN_LANG_STRING ALL
382 %token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
383 %token <pi> PRE_PARSED_FUNCTION_DECL
384 %type <ttype> component_constructor_declarator
385 %type <ttype> fn.def2 return_id constructor_declarator
386 %type <itype> ctor_initializer_opt function_try_block
387 %type <ttype> named_class_head_sans_basetype
388 %type <ftype> class_head named_class_head
389 %type <ftype> named_complex_class_head_sans_basetype
390 %type <ttype> unnamed_class_head
391 %type <ttype> base_class_list
392 %type <ttype> base_class_access_list
393 %type <ttype> base_class maybe_base_class_list base_class.1
394 %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
395 %type <ttype> operator_name
396 %type <ttype> object aggr
397 %type <itype> new delete
398 /* %type <ttype> primary_no_id */
399 %type <ttype> maybe_parmlist
400 %type <ttype> member_init
401 %type <ftype> member_init_list
402 %type <ttype> template_parm_header template_spec_header template_header
403 %type <ttype> template_parm_list template_parm
404 %type <ttype> template_type_parm template_template_parm
405 %type <code> template_close_bracket
406 %type <ttype> apparent_template_type
407 %type <ttype> template_type template_arg_list template_arg_list_opt
408 %type <ttype> template_arg
409 %type <ttype> condition xcond paren_cond_or_null
410 %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
411 %type <ttype> complete_type_name notype_identifier nonnested_type
412 %type <ttype> complex_type_name nested_name_specifier_1
413 %type <ttype> new_initializer new_placement
414 %type <ttype> using_decl
415 %type <ttype> typename_sub typename_sub0 typename_sub1 typename_sub2
416 %type <ttype> explicit_template_type
417 /* in order to recognize aggr tags as defining and thus shadowing. */
418 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
419 %type <ttype> named_class_head_sans_basetype_defn
420 %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
421 %type <ttype> handler_args
422 %type <ttype> self_template_type .finish_template_type
427 /* Used in lex.c for parsing pragmas. */
430 /* lex.c and pt.c depend on this being the last token. Define
431 any new tokens before this one! */
432 %token END_OF_SAVED_INPUT
435 /* Tell yyparse how to print a token's value, if yydebug is set. */
436 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
437 extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
443 { finish_translation_unit (); }
445 { finish_translation_unit (); }
448 /* the reason for the strange actions in this rule
449 is so that notype_initdecls when reached via datadef
450 can find a valid list of type and sc specs in $0. */
453 { $<ttype>$ = NULL_TREE; }
455 { $<ttype>$ = NULL_TREE; ggc_collect (); }
456 | extdefs lang_extdef
457 { $<ttype>$ = NULL_TREE; ggc_collect (); }
466 { have_extern_spec = 1;
467 used_extern_spec = 0;
468 $<ttype>$ = NULL_TREE; }
471 { have_extern_spec = 0; }
485 { if (pending_lang_change) do_pending_lang_change();
486 type_lookups = NULL_TREE; }
488 { if (! toplevel_bindings_p ())
493 fndef eat_saved_input
494 { do_pending_inlines (); }
496 { do_pending_inlines (); }
499 { cp_warning ("keyword `export' not implemented, and will be ignored"); }
501 { do_pending_inlines (); }
503 { do_pending_inlines (); }
504 | asm_keyword '(' string ')' ';'
505 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
507 | extern_lang_string '{' extdefs_opt '}'
508 { pop_lang_context (); }
509 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
510 { do_pending_inlines (); pop_lang_context (); }
511 | extern_lang_string .hush_warning datadef .warning_ok
512 { do_pending_inlines (); pop_lang_context (); }
513 | NAMESPACE identifier '{'
514 { push_namespace ($2); }
516 { pop_namespace (); }
518 { push_namespace (NULL_TREE); }
520 { pop_namespace (); }
523 { do_toplevel_using_decl ($1); }
530 NAMESPACE identifier '='
531 { begin_only_namespace_names (); }
534 end_only_namespace_names ();
537 do_namespace_alias ($2, $5);
544 | USING global_scope qualified_id
546 | USING global_scope unqualified_id
550 namespace_using_decl:
551 USING namespace_qualifier identifier
552 { $$ = build_nt (SCOPE_REF, $2, $3); }
553 | USING global_scope identifier
554 { $$ = build_nt (SCOPE_REF, global_namespace, $3); }
555 | USING global_scope namespace_qualifier identifier
556 { $$ = build_nt (SCOPE_REF, $3, $4); }
561 { begin_only_namespace_names (); }
564 end_only_namespace_names ();
565 /* If no declaration was found, the using-directive is
566 invalid. Since that was not reported, we need the
567 identifier for the error message. */
568 if (TREE_CODE ($4) == IDENTIFIER_NODE && lastiddecl)
570 do_using_directive ($4);
577 if (TREE_CODE ($$) == IDENTIFIER_NODE)
581 | namespace_qualifier NSNAME SCOPE
584 if (TREE_CODE ($$) == IDENTIFIER_NODE)
592 | global_scope qualified_id
594 | global_scope unqualified_id
600 { push_lang_context ($1); }
601 | extern_lang_string EXTERN_LANG_STRING
602 { if (current_lang_name != $2)
603 cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
604 pop_lang_context (); push_lang_context ($2); }
607 template_parm_header:
609 { begin_template_parm_list (); }
610 template_parm_list '>'
611 { $$ = end_template_parm_list ($4); }
614 template_spec_header:
616 { begin_specialization();
622 | template_spec_header
627 { $$ = process_template_parm (NULL_TREE, $1); }
628 | template_parm_list ',' template_parm
629 { $$ = process_template_parm ($1, $3); }
639 aggr maybe_identifier
640 { $$ = finish_template_type_parm ($1, $2); }
641 | TYPENAME_KEYWORD maybe_identifier
642 { $$ = finish_template_type_parm (class_type_node, $2); }
645 template_template_parm:
646 template_parm_header aggr maybe_identifier
647 { $$ = finish_template_template_parm ($2, $3); }
651 /* The following rules introduce a new reduce/reduce
652 conflict on the ',' and '>' input tokens: they are valid
653 prefixes for a `structsp', which means they could match a
654 nameless parameter. See 14.6, paragraph 3.
655 By putting them before the `parm' rule, we get
656 their match before considering them nameless parameter
659 { $$ = build_tree_list (NULL_TREE, $1); }
660 | template_type_parm '=' type_id
661 { $$ = build_tree_list (groktypename ($3.t), $1); }
663 { $$ = build_tree_list (NULL_TREE, $1.t); }
664 | parm '=' expr_no_comma_rangle
665 { $$ = build_tree_list ($3, $1.t); }
666 | template_template_parm
667 { $$ = build_tree_list (NULL_TREE, $1); }
668 | template_template_parm '=' template_arg
670 if (TREE_CODE ($3) != TEMPLATE_DECL
671 && TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM
672 && TREE_CODE ($3) != TYPE_DECL)
674 error ("invalid default template argument");
675 $3 = error_mark_node;
677 $$ = build_tree_list ($3, $1);
682 template_header template_extdef
683 { finish_template_decl ($1); }
684 | template_header error %prec EMPTY
685 { finish_template_decl ($1); }
689 fndef eat_saved_input
690 { do_pending_inlines (); }
692 { do_pending_inlines (); }
694 { do_pending_inlines (); }
695 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
696 { do_pending_inlines ();
697 pop_lang_context (); }
698 | extern_lang_string .hush_warning template_datadef .warning_ok
699 { do_pending_inlines ();
700 pop_lang_context (); }
701 | extension template_extdef
707 | declmods notype_initdecls ';'
709 | typed_declspecs initdecls ';'
710 { note_list_got_semicolon ($1.t); }
713 if ($1.t != error_mark_node)
715 maybe_process_partial_specialization ($1.t);
716 note_got_semicolon ($1.t);
723 | declmods notype_initdecls ';'
725 | typed_declspecs initdecls ';'
726 { note_list_got_semicolon ($1.t); }
728 { pedwarn ("empty declaration"); }
729 | explicit_instantiation ';'
730 | typed_declspecs ';'
733 split_specs_attrs ($1.t, &t, &attrs);
735 note_list_got_semicolon ($1.t);
739 | error END_OF_SAVED_INPUT
745 ctor_initializer_opt:
764 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
765 { expand_body (finish_function ((int)$3)); }
766 | fn.def1 maybe_return_init function_try_block
767 { expand_body (finish_function ((int)$3)); }
768 | fn.def1 maybe_return_init error
772 constructor_declarator:
773 nested_name_specifier SELFNAME '('
774 { $$ = begin_constructor_declarator ($1, $2); }
775 parmlist ')' cv_qualifiers exception_specification_opt
776 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
777 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
778 { $$ = begin_constructor_declarator ($1, $2);
779 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
781 | global_scope nested_name_specifier SELFNAME '('
782 { $$ = begin_constructor_declarator ($2, $3); }
783 parmlist ')' cv_qualifiers exception_specification_opt
784 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
785 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
786 { $$ = begin_constructor_declarator ($2, $3);
787 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
789 | nested_name_specifier self_template_type '('
790 { $$ = begin_constructor_declarator ($1, $2); }
791 parmlist ')' cv_qualifiers exception_specification_opt
792 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
793 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
794 { $$ = begin_constructor_declarator ($1, $2);
795 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
797 | global_scope nested_name_specifier self_template_type '('
798 { $$ = begin_constructor_declarator ($2, $3); }
799 parmlist ')' cv_qualifiers exception_specification_opt
800 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
801 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
802 { $$ = begin_constructor_declarator ($2, $3);
803 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
808 typed_declspecs declarator
809 { check_for_new_type ("return type", $1);
810 if (!begin_function_definition ($1.t, $2))
812 | declmods notype_declarator
813 { if (!begin_function_definition ($1.t, $2))
816 { if (!begin_function_definition (NULL_TREE, $1))
818 | declmods constructor_declarator
819 { if (!begin_function_definition ($1.t, $2))
821 | constructor_declarator
822 { if (!begin_function_definition (NULL_TREE, $1))
826 /* ANSI allows optional parentheses around constructor class names.
827 See ISO/IEC 14882:1998(E) 12.1. */
829 component_constructor_declarator:
830 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
831 { $$ = make_call_declarator ($1, $3, $5, $6); }
832 | '(' SELFNAME ')' '(' parmlist ')' cv_qualifiers
833 exception_specification_opt
834 { $$ = make_call_declarator ($2, $5, $7, $8); }
835 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
836 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
837 | '(' SELFNAME ')' LEFT_RIGHT cv_qualifiers exception_specification_opt
838 { $$ = make_call_declarator ($2, empty_parms (), $5, $6); }
839 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
840 { $$ = make_call_declarator ($1, $3, $5, $6); }
841 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
842 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
845 /* more C++ complexity. See component_decl for a comment on the
846 reduce/reduce conflict introduced by these rules. */
848 declmods component_constructor_declarator
849 { $$ = parse_method ($2, $1.t, $1.lookups);
853 if (yychar == YYEMPTY)
856 | component_constructor_declarator
857 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
859 | typed_declspecs declarator
860 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
861 | declmods notype_declarator
862 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
864 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
866 | declmods constructor_declarator
867 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
868 | constructor_declarator
869 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
874 RETURN_KEYWORD IDENTIFIER
882 { finish_named_return_value ($<ttype>$, $2); }
883 | return_id '(' nonnull_exprlist ')'
884 { finish_named_return_value ($<ttype>$, $3); }
885 | return_id LEFT_RIGHT
886 { finish_named_return_value ($<ttype>$, NULL_TREE); }
890 ':' .set_base_init member_init_list
892 if ($3.new_type_flag == 0)
893 error ("no base or member initializers given following ':'");
895 finish_mem_initializers ($3.t);
902 if (DECL_CONSTRUCTOR_P (current_function_decl))
903 /* Make a contour for the initializer list. */
905 else if (current_class_type == NULL_TREE)
906 error ("base initializers not allowed for non-member functions");
907 else if (! DECL_CONSTRUCTOR_P (current_function_decl))
908 error ("only constructors take base initializers");
915 $$.new_type_flag = 0;
920 $$.new_type_flag = 1;
923 | member_init_list ',' member_init
927 $$.new_type_flag = 1;
928 TREE_CHAIN ($3) = $1.t;
934 | member_init_list error
938 '(' nonnull_exprlist ')'
940 if (current_class_name)
941 pedwarn ("anachronistic old style base class initializer");
942 $$ = expand_member_init (current_class_ref, NULL_TREE, $2);
946 if (current_class_name)
947 pedwarn ("anachronistic old style base class initializer");
948 $$ = expand_member_init (current_class_ref,
952 | notype_identifier '(' nonnull_exprlist ')'
953 { $$ = expand_member_init (current_class_ref, $1, $3); }
954 | notype_identifier LEFT_RIGHT
955 { $$ = expand_member_init (current_class_ref, $1,
957 | nonnested_type '(' nonnull_exprlist ')'
958 { $$ = expand_member_init (current_class_ref, $1, $3); }
959 | nonnested_type LEFT_RIGHT
960 { $$ = expand_member_init (current_class_ref, $1,
962 | typename_sub '(' nonnull_exprlist ')'
963 { $$ = expand_member_init (current_class_ref, $1, $3); }
964 | typename_sub LEFT_RIGHT
965 { $$ = expand_member_init (current_class_ref, $1,
991 explicit_instantiation:
992 TEMPLATE begin_explicit_instantiation typespec ';'
993 { do_type_instantiation ($3.t, NULL_TREE, 1);
995 end_explicit_instantiation
996 | TEMPLATE begin_explicit_instantiation typed_declspecs declarator
997 { tree specs = strip_attrs ($3.t);
998 do_decl_instantiation (specs, $4, NULL_TREE); }
999 end_explicit_instantiation
1000 | TEMPLATE begin_explicit_instantiation notype_declarator
1001 { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); }
1002 end_explicit_instantiation
1003 | TEMPLATE begin_explicit_instantiation constructor_declarator
1004 { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); }
1005 end_explicit_instantiation
1006 | SCSPEC TEMPLATE begin_explicit_instantiation typespec ';'
1007 { do_type_instantiation ($4.t, $1, 1);
1008 yyungetc (';', 1); }
1009 end_explicit_instantiation
1010 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
1012 { tree specs = strip_attrs ($4.t);
1013 do_decl_instantiation (specs, $5, $1); }
1014 end_explicit_instantiation
1015 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
1016 { do_decl_instantiation (NULL_TREE, $4, $1); }
1017 end_explicit_instantiation
1018 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
1019 { do_decl_instantiation (NULL_TREE, $4, $1); }
1020 end_explicit_instantiation
1023 begin_explicit_instantiation:
1024 { begin_explicit_instantiation(); }
1026 end_explicit_instantiation:
1027 { end_explicit_instantiation(); }
1029 /* The TYPENAME expansions are to deal with use of a template class name as
1030 a template within the class itself, where the template decl is hidden by
1031 a type decl. Got all that? */
1034 PTYPENAME '<' template_arg_list_opt template_close_bracket
1035 .finish_template_type
1037 | TYPENAME '<' template_arg_list_opt template_close_bracket
1038 .finish_template_type
1040 | self_template_type
1043 apparent_template_type:
1045 | identifier '<' template_arg_list_opt '>'
1046 .finish_template_type
1050 SELFNAME '<' template_arg_list_opt template_close_bracket
1051 .finish_template_type
1055 .finish_template_type:
1057 if (yychar == YYEMPTY)
1060 $$ = finish_template_type ($<ttype>-3, $<ttype>-1,
1064 template_close_bracket:
1068 /* Handle `Class<Class<Type>>' without space in the `>>' */
1069 pedwarn ("`>>' should be `> >' in template class name");
1074 template_arg_list_opt:
1082 { $$ = build_tree_list (NULL_TREE, $$); }
1083 | template_arg_list ',' template_arg
1084 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
1089 { $$ = groktypename ($1.t); }
1093 if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
1094 $$ = TREE_TYPE ($$);
1096 | global_scope PTYPENAME
1099 if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
1100 $$ = TREE_TYPE ($$);
1102 | expr_no_comma_rangle
1107 { $$ = NEGATE_EXPR; }
1109 { $$ = CONVERT_EXPR; }
1111 { $$ = PREINCREMENT_EXPR; }
1113 { $$ = PREDECREMENT_EXPR; }
1115 { $$ = TRUTH_NOT_EXPR; }
1120 { $$ = build_x_compound_expr ($$); }
1126 { error ("ISO C++ forbids an empty condition for `%s'",
1128 $$ = integer_zero_node; }
1135 { error ("ISO C++ forbids an empty condition for `%s'",
1137 $$ = integer_zero_node; }
1151 type_specifier_seq declarator maybeasm maybe_attribute '='
1154 for (d = getdecls (); d; d = TREE_CHAIN (d))
1155 if (TREE_CODE (d) == TYPE_DECL) {
1156 tree s = TREE_TYPE (d);
1157 if (TREE_CODE (s) == RECORD_TYPE)
1158 cp_error ("definition of class `%T' in condition", s);
1159 else if (TREE_CODE (s) == ENUMERAL_TYPE)
1160 cp_error ("definition of enum `%T' in condition", s);
1163 current_declspecs = $1.t;
1164 $<ttype>$ = parse_decl ($<ttype>2, $4, 1);
1168 parse_end_decl ($<ttype>6, $7, $4);
1169 $$ = convert_from_reference ($<ttype>6);
1170 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
1171 cp_error ("definition of array `%#D' in condition", $$);
1178 | maybe_label_decls stmts '}'
1179 | maybe_label_decls stmts error '}'
1180 | maybe_label_decls error '}'
1183 already_scoped_stmt:
1185 { $<ttype>$ = begin_compound_stmt (1); }
1187 { STMT_LINENO ($<ttype>3) = $1;
1188 finish_compound_stmt (1, $<ttype>3); }
1189 | save_lineno simple_stmt
1190 { if ($2) STMT_LINENO ($2) = $1; }
1193 nontrivial_exprlist:
1194 expr_no_commas ',' expr_no_commas
1195 { $$ = tree_cons (NULL_TREE, $$,
1196 build_tree_list (NULL_TREE, $3)); }
1197 | expr_no_commas ',' error
1198 { $$ = tree_cons (NULL_TREE, $$,
1199 build_tree_list (NULL_TREE, error_mark_node)); }
1200 | nontrivial_exprlist ',' expr_no_commas
1201 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1202 | nontrivial_exprlist ',' error
1203 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1208 { $$ = build_tree_list (NULL_TREE, $$); }
1209 | nontrivial_exprlist
1215 /* __extension__ turns off -pedantic for following primary. */
1216 | extension cast_expr %prec UNARY
1219 | '*' cast_expr %prec UNARY
1220 { $$ = build_x_indirect_ref ($2, "unary *"); }
1221 | '&' cast_expr %prec UNARY
1222 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1224 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1225 | unop cast_expr %prec UNARY
1226 { $$ = finish_unary_op_expr ($1, $2); }
1227 /* Refer to the address of a label as a pointer. */
1229 { $$ = finish_label_address_expr ($2); }
1230 | SIZEOF unary_expr %prec UNARY
1231 { $$ = finish_sizeof ($2); }
1232 | SIZEOF '(' type_id ')' %prec HYPERUNARY
1233 { $$ = finish_sizeof (groktypename ($3.t));
1234 check_for_new_type ("sizeof", $3); }
1235 | ALIGNOF unary_expr %prec UNARY
1236 { $$ = finish_alignof ($2); }
1237 | ALIGNOF '(' type_id ')' %prec HYPERUNARY
1238 { $$ = finish_alignof (groktypename ($3.t));
1239 check_for_new_type ("alignof", $3); }
1241 /* The %prec EMPTY's here are required by the = init initializer
1242 syntax extension; see below. */
1243 | new new_type_id %prec EMPTY
1244 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1245 check_for_new_type ("new", $2); }
1246 | new new_type_id new_initializer
1247 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1248 check_for_new_type ("new", $2); }
1249 | new new_placement new_type_id %prec EMPTY
1250 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1251 check_for_new_type ("new", $3); }
1252 | new new_placement new_type_id new_initializer
1253 { $$ = build_new ($2, $3.t, $4, $1);
1254 check_for_new_type ("new", $3); }
1255 | new '(' type_id ')'
1257 { $$ = build_new (NULL_TREE, groktypename($3.t),
1259 check_for_new_type ("new", $3); }
1260 | new '(' type_id ')' new_initializer
1261 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1262 check_for_new_type ("new", $3); }
1263 | new new_placement '(' type_id ')' %prec EMPTY
1264 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1265 check_for_new_type ("new", $4); }
1266 | new new_placement '(' type_id ')' new_initializer
1267 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1268 check_for_new_type ("new", $4); }
1270 | delete cast_expr %prec UNARY
1271 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1272 | delete '[' ']' cast_expr %prec UNARY
1273 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1274 if (yychar == YYEMPTY)
1276 | delete '[' expr ']' cast_expr %prec UNARY
1277 { $$ = delete_sanity ($5, $3, 2, $1);
1278 if (yychar == YYEMPTY)
1280 | REALPART cast_expr %prec UNARY
1281 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1282 | IMAGPART cast_expr %prec UNARY
1283 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1287 '(' nonnull_exprlist ')'
1289 | '{' nonnull_exprlist '}'
1290 { cp_pedwarn ("old style placement syntax, use () instead");
1295 '(' nonnull_exprlist ')'
1298 { $$ = void_zero_node; }
1301 cp_error ("`%T' is not a valid expression", $2.t);
1302 $$ = error_mark_node;
1304 /* GNU extension so people can use initializer lists. Note that
1305 this alters the meaning of `new int = 1', which was previously
1306 syntactically valid but semantically invalid.
1307 This feature is now deprecated and will be removed in a future
1312 pedwarn ("ISO C++ forbids initialization of new expression with `='");
1313 cp_deprecated ("new initializer lists extension");
1314 if (TREE_CODE ($2) != TREE_LIST
1315 && TREE_CODE ($2) != CONSTRUCTOR)
1316 $$ = build_tree_list (NULL_TREE, $2);
1322 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1324 '(' type_id ')' %prec EMPTY
1325 { $2.t = finish_parmlist (build_tree_list (NULL_TREE, $2.t), 0);
1326 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1327 check_for_new_type ("cast", $2); }
1328 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1329 { $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0);
1330 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1331 check_for_new_type ("cast", $3); }
1336 | regcast_or_absdcl unary_expr %prec UNARY
1337 { $$ = reparse_absdcl_as_casts ($$, $2); }
1338 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1340 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1343 pedwarn ("ISO C++ forbids compound literals");
1344 /* Indicate that this was a C99 compound literal. */
1345 TREE_HAS_CONSTRUCTOR (init) = 1;
1347 $$ = reparse_absdcl_as_casts ($$, init);
1353 /* Handle general members. */
1354 | expr_no_commas POINTSAT_STAR expr_no_commas
1355 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1356 | expr_no_commas DOT_STAR expr_no_commas
1357 { $$ = build_m_component_ref ($$, $3); }
1358 | expr_no_commas '+' expr_no_commas
1359 { $$ = build_x_binary_op ($2, $$, $3); }
1360 | expr_no_commas '-' expr_no_commas
1361 { $$ = build_x_binary_op ($2, $$, $3); }
1362 | expr_no_commas '*' expr_no_commas
1363 { $$ = build_x_binary_op ($2, $$, $3); }
1364 | expr_no_commas '/' expr_no_commas
1365 { $$ = build_x_binary_op ($2, $$, $3); }
1366 | expr_no_commas '%' expr_no_commas
1367 { $$ = build_x_binary_op ($2, $$, $3); }
1368 | expr_no_commas LSHIFT expr_no_commas
1369 { $$ = build_x_binary_op ($2, $$, $3); }
1370 | expr_no_commas RSHIFT expr_no_commas
1371 { $$ = build_x_binary_op ($2, $$, $3); }
1372 | expr_no_commas ARITHCOMPARE expr_no_commas
1373 { $$ = build_x_binary_op ($2, $$, $3); }
1374 | expr_no_commas '<' expr_no_commas
1375 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1376 | expr_no_commas '>' expr_no_commas
1377 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1378 | expr_no_commas EQCOMPARE expr_no_commas
1379 { $$ = build_x_binary_op ($2, $$, $3); }
1380 | expr_no_commas MIN_MAX expr_no_commas
1381 { $$ = build_x_binary_op ($2, $$, $3); }
1382 | expr_no_commas '&' expr_no_commas
1383 { $$ = build_x_binary_op ($2, $$, $3); }
1384 | expr_no_commas '|' expr_no_commas
1385 { $$ = build_x_binary_op ($2, $$, $3); }
1386 | expr_no_commas '^' expr_no_commas
1387 { $$ = build_x_binary_op ($2, $$, $3); }
1388 | expr_no_commas ANDAND expr_no_commas
1389 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1390 | expr_no_commas OROR expr_no_commas
1391 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1392 | expr_no_commas '?' xexpr ':' expr_no_commas
1393 { $$ = build_x_conditional_expr ($$, $3, $5); }
1394 | expr_no_commas '=' expr_no_commas
1395 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1396 if ($$ != error_mark_node)
1397 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1398 | expr_no_commas ASSIGN expr_no_commas
1399 { $$ = build_x_modify_expr ($$, $2, $3); }
1401 { $$ = build_throw (NULL_TREE); }
1402 | THROW expr_no_commas
1403 { $$ = build_throw ($2); }
1406 expr_no_comma_rangle:
1408 /* Handle general members. */
1409 | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
1410 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1411 | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
1412 { $$ = build_m_component_ref ($$, $3); }
1413 | expr_no_comma_rangle '+' expr_no_comma_rangle
1414 { $$ = build_x_binary_op ($2, $$, $3); }
1415 | expr_no_comma_rangle '-' expr_no_comma_rangle
1416 { $$ = build_x_binary_op ($2, $$, $3); }
1417 | expr_no_comma_rangle '*' expr_no_comma_rangle
1418 { $$ = build_x_binary_op ($2, $$, $3); }
1419 | expr_no_comma_rangle '/' expr_no_comma_rangle
1420 { $$ = build_x_binary_op ($2, $$, $3); }
1421 | expr_no_comma_rangle '%' expr_no_comma_rangle
1422 { $$ = build_x_binary_op ($2, $$, $3); }
1423 | expr_no_comma_rangle LSHIFT expr_no_comma_rangle
1424 { $$ = build_x_binary_op ($2, $$, $3); }
1425 | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
1426 { $$ = build_x_binary_op ($2, $$, $3); }
1427 | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
1428 { $$ = build_x_binary_op ($2, $$, $3); }
1429 | expr_no_comma_rangle '<' expr_no_comma_rangle
1430 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1431 | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
1432 { $$ = build_x_binary_op ($2, $$, $3); }
1433 | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
1434 { $$ = build_x_binary_op ($2, $$, $3); }
1435 | expr_no_comma_rangle '&' expr_no_comma_rangle
1436 { $$ = build_x_binary_op ($2, $$, $3); }
1437 | expr_no_comma_rangle '|' expr_no_comma_rangle
1438 { $$ = build_x_binary_op ($2, $$, $3); }
1439 | expr_no_comma_rangle '^' expr_no_comma_rangle
1440 { $$ = build_x_binary_op ($2, $$, $3); }
1441 | expr_no_comma_rangle ANDAND expr_no_comma_rangle
1442 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1443 | expr_no_comma_rangle OROR expr_no_comma_rangle
1444 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1445 | expr_no_comma_rangle '?' xexpr ':' expr_no_comma_rangle
1446 { $$ = build_x_conditional_expr ($$, $3, $5); }
1447 | expr_no_comma_rangle '=' expr_no_comma_rangle
1448 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1449 if ($$ != error_mark_node)
1450 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1451 | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
1452 { $$ = build_x_modify_expr ($$, $2, $3); }
1454 { $$ = build_throw (NULL_TREE); }
1455 | THROW expr_no_comma_rangle
1456 { $$ = build_throw ($2); }
1459 notype_unqualified_id:
1460 '~' see_typename identifier
1461 { $$ = build_nt (BIT_NOT_EXPR, $3); }
1462 | '~' see_typename template_type
1463 { $$ = build_nt (BIT_NOT_EXPR, $3); }
1468 | NSNAME %prec EMPTY
1473 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1474 means that we're in an expression like S::f<int>, so
1475 don't do_identifier; we only do that for unqualified
1477 if (!lastiddecl || TREE_CODE (lastiddecl) != TREE_LIST)
1478 $$ = do_identifier ($<ttype>-1, 1, NULL_TREE);
1484 PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket
1485 { $$ = lookup_template_function ($3, $4); }
1486 | operator_name '<' do_id template_arg_list_opt template_close_bracket
1487 { $$ = lookup_template_function ($3, $4); }
1491 TEMPLATE identifier '<' template_arg_list_opt template_close_bracket
1492 { $$ = lookup_template_function ($2, $4); }
1493 | TEMPLATE PFUNCNAME '<' template_arg_list_opt template_close_bracket
1494 { $$ = lookup_template_function ($2, $4); }
1495 | TEMPLATE operator_name '<' template_arg_list_opt
1496 template_close_bracket
1497 { $$ = lookup_template_function ($2, $4); }
1501 notype_unqualified_id
1506 expr_or_declarator_intern:
1508 | attributes expr_or_declarator
1510 /* Provide support for '(' attributes '*' declarator ')'
1512 $$ = tree_cons ($1, $2, NULL_TREE);
1517 notype_unqualified_id
1518 | '*' expr_or_declarator_intern %prec UNARY
1519 { $$ = build_nt (INDIRECT_REF, $2); }
1520 | '&' expr_or_declarator_intern %prec UNARY
1521 { $$ = build_nt (ADDR_EXPR, $2); }
1522 | '(' expr_or_declarator_intern ')'
1526 notype_template_declarator:
1527 IDENTIFIER '<' template_arg_list_opt template_close_bracket
1528 { $$ = lookup_template_function ($1, $3); }
1529 | NSNAME '<' template_arg_list template_close_bracket
1530 { $$ = lookup_template_function ($1, $3); }
1533 direct_notype_declarator:
1534 complex_direct_notype_declarator
1535 /* This precedence declaration is to prefer this reduce
1536 to the Koenig lookup shift in primary, below. I hate yacc. */
1537 | notype_unqualified_id %prec '('
1538 | notype_template_declarator
1539 | '(' expr_or_declarator_intern ')'
1540 { $$ = finish_decl_parsing ($2); }
1544 notype_unqualified_id
1546 if (TREE_CODE ($1) == BIT_NOT_EXPR)
1547 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($1, 0));
1549 $$ = finish_id_expr ($1);
1555 $$ = combine_strings ($$);
1556 /* combine_strings doesn't set up TYPE_MAIN_VARIANT of
1557 a const array the way we want, so fix it. */
1558 if (flag_const_strings)
1559 TREE_TYPE ($$) = build_cplus_array_type
1560 (TREE_TYPE (TREE_TYPE ($$)),
1561 TYPE_DOMAIN (TREE_TYPE ($$)));
1565 $$ = fname_decl (C_RID_CODE ($$), $$);
1566 if (processing_template_decl)
1567 $$ = build_min_nt (LOOKUP_EXPR, DECL_NAME ($$));
1570 { $$ = finish_parenthesized_expr ($2); }
1571 | '(' expr_or_declarator_intern ')'
1572 { $2 = reparse_decl_as_expr (NULL_TREE, $2);
1573 $$ = finish_parenthesized_expr ($2); }
1575 { $$ = error_mark_node; }
1577 { tree scope = current_scope ();
1578 if (!scope || TREE_CODE (scope) != FUNCTION_DECL)
1580 error ("braced-group within expression allowed only inside a function");
1584 pedwarn ("ISO C++ forbids braced-groups within expressions");
1585 $<ttype>$ = begin_stmt_expr ();
1588 { $$ = finish_stmt_expr ($<ttype>2); }
1589 /* Koenig lookup support
1590 We could store lastiddecl in $1 to avoid another lookup,
1591 but that would result in many additional reduce/reduce conflicts. */
1592 | notype_unqualified_id '(' nonnull_exprlist ')'
1593 { $$ = finish_call_expr ($1, $3, 1); }
1594 | notype_unqualified_id LEFT_RIGHT
1595 { $$ = finish_call_expr ($1, NULL_TREE, 1); }
1596 | primary '(' nonnull_exprlist ')'
1597 { $$ = finish_call_expr ($1, $3, 0); }
1598 | primary LEFT_RIGHT
1599 { $$ = finish_call_expr ($1, NULL_TREE, 0); }
1600 | VA_ARG '(' expr_no_commas ',' type_id ')'
1601 { $$ = build_x_va_arg ($3, groktypename ($5.t));
1602 check_for_new_type ("__builtin_va_arg", $5); }
1603 | primary '[' expr ']'
1604 { $$ = grok_array_decl ($$, $3); }
1606 { $$ = finish_increment_expr ($1, POSTINCREMENT_EXPR); }
1607 | primary MINUSMINUS
1608 { $$ = finish_increment_expr ($1, POSTDECREMENT_EXPR); }
1609 /* C++ extensions */
1611 { $$ = finish_this_expr (); }
1612 | CV_QUALIFIER '(' nonnull_exprlist ')'
1614 /* This is a C cast in C++'s `functional' notation
1615 using the "implicit int" extension so that:
1616 `const (3)' is equivalent to `const int (3)'. */
1619 type = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1620 type = groktypename (build_tree_list (type, NULL_TREE));
1621 $$ = build_functional_cast (type, $3);
1624 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1625 { tree type = groktypename ($3.t);
1626 check_for_new_type ("dynamic_cast", $3);
1627 $$ = build_dynamic_cast (type, $6); }
1628 | STATIC_CAST '<' type_id '>' '(' expr ')'
1629 { tree type = groktypename ($3.t);
1630 check_for_new_type ("static_cast", $3);
1631 $$ = build_static_cast (type, $6); }
1632 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1633 { tree type = groktypename ($3.t);
1634 check_for_new_type ("reinterpret_cast", $3);
1635 $$ = build_reinterpret_cast (type, $6); }
1636 | CONST_CAST '<' type_id '>' '(' expr ')'
1637 { tree type = groktypename ($3.t);
1638 check_for_new_type ("const_cast", $3);
1639 $$ = build_const_cast (type, $6); }
1640 | TYPEID '(' expr ')'
1641 { $$ = build_typeid ($3); }
1642 | TYPEID '(' type_id ')'
1643 { tree type = groktypename ($3.t);
1644 check_for_new_type ("typeid", $3);
1645 $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
1646 | global_scope IDENTIFIER
1647 { $$ = do_scoped_id ($2, 1); }
1648 | global_scope template_id
1650 | global_scope operator_name
1652 got_scope = NULL_TREE;
1653 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1654 $$ = do_scoped_id ($2, 1);
1658 | overqualified_id %prec HYPERUNARY
1659 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1660 | overqualified_id '(' nonnull_exprlist ')'
1661 { $$ = finish_qualified_call_expr ($1, $3); }
1662 | overqualified_id LEFT_RIGHT
1663 { $$ = finish_qualified_call_expr ($1, NULL_TREE); }
1664 | object object_template_id %prec UNARY
1666 $$ = build_x_component_ref ($$, $2, NULL_TREE, 1);
1668 | object object_template_id '(' nonnull_exprlist ')'
1669 { $$ = finish_object_call_expr ($2, $1, $4); }
1670 | object object_template_id LEFT_RIGHT
1671 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1672 | object unqualified_id %prec UNARY
1673 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1674 | object overqualified_id %prec UNARY
1675 { if (processing_template_decl)
1676 $$ = build_min_nt (COMPONENT_REF, $1, $2);
1678 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1679 | object unqualified_id '(' nonnull_exprlist ')'
1680 { $$ = finish_object_call_expr ($2, $1, $4); }
1681 | object unqualified_id LEFT_RIGHT
1682 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1683 | object overqualified_id '(' nonnull_exprlist ')'
1684 { $$ = finish_qualified_object_call_expr ($2, $1, $4); }
1685 | object overqualified_id LEFT_RIGHT
1686 { $$ = finish_qualified_object_call_expr ($2, $1, NULL_TREE); }
1687 /* p->int::~int() is valid -- 12.4 */
1688 | object '~' TYPESPEC LEFT_RIGHT
1689 { $$ = finish_pseudo_destructor_call_expr ($1, NULL_TREE, $3); }
1690 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1691 { $$ = finish_pseudo_destructor_call_expr ($1, $2, $5); }
1694 $$ = error_mark_node;
1698 /* Not needed for now.
1704 { $$ = error_mark_node; }
1706 { if (current_function_decl == 0)
1708 error ("braced-group within expression allowed only inside a function");
1711 $<ttype>$ = expand_start_stmt_expr (); }
1714 pedwarn ("ISO C++ forbids braced-groups within expressions");
1715 $$ = expand_end_stmt_expr ($<ttype>2); }
1716 | primary_no_id '(' nonnull_exprlist ')'
1717 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1718 | primary_no_id LEFT_RIGHT
1719 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1720 | primary_no_id '[' expr ']'
1722 | primary_no_id PLUSPLUS
1723 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1724 | primary_no_id MINUSMINUS
1725 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1727 { goto do_scoped_id; }
1728 | SCOPE operator_name
1729 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1731 goto do_scoped_operator;
1740 { got_scope = NULL_TREE; $$ = 1; }
1746 | global_scope delete
1747 { got_scope = NULL_TREE; $$ = 1; }
1752 { $$ = boolean_true_node; }
1754 { $$ = boolean_false_node; }
1757 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1761 { $$ = chainon ($$, $2); }
1767 setup_vtbl_ptr (NULL_TREE, NULL_TREE);
1773 { got_object = TREE_TYPE ($$); }
1776 $$ = build_x_arrow ($$);
1777 got_object = TREE_TYPE ($$);
1782 typespec initdecls ';'
1784 if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1785 note_got_semicolon ($1.t);
1787 | typed_declspecs initdecls ';'
1789 note_list_got_semicolon ($1.t);
1791 | declmods notype_initdecls ';'
1793 | typed_declspecs ';'
1796 note_list_got_semicolon ($1.t);
1799 { warning ("empty declaration"); }
1804 /* Any kind of declarator (thus, all declarators allowed
1805 after an explicit typespec). */
1808 after_type_declarator %prec EMPTY
1809 | notype_declarator %prec EMPTY
1812 /* This is necessary to postpone reduction of `int()()()()'. */
1814 LEFT_RIGHT %prec EMPTY
1815 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1816 NULL_TREE, NULL_TREE); }
1817 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1818 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1822 /* ISO type-id (8.1) */
1824 typed_typespecs absdcl
1825 { $$.t = build_tree_list ($1.t, $2);
1826 $$.new_type_flag = $1.new_type_flag; }
1827 | nonempty_cv_qualifiers absdcl
1828 { $$.t = build_tree_list ($1.t, $2);
1829 $$.new_type_flag = $1.new_type_flag; }
1831 { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
1833 $$.new_type_flag = $1.new_type_flag; }
1834 | typed_typespecs %prec EMPTY
1835 { $$.t = build_tree_list ($1.t, NULL_TREE);
1836 $$.new_type_flag = $1.new_type_flag; }
1837 | nonempty_cv_qualifiers %prec EMPTY
1838 { $$.t = build_tree_list ($1.t, NULL_TREE);
1839 $$.new_type_flag = $1.new_type_flag; }
1842 /* Declspecs which contain at least one type specifier or typedef name.
1843 (Just `const' or `volatile' is not enough.)
1844 A typedef'd name following these is taken as a name to be declared.
1845 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1848 typed_typespecs %prec EMPTY
1849 { $$.lookups = type_lookups; }
1851 { $$.lookups = type_lookups; }
1856 { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
1857 $$.new_type_flag = $2.new_type_flag; }
1858 | typespec reserved_declspecs %prec HYPERUNARY
1859 { $$.t = tree_cons (NULL_TREE, $1.t, $2);
1860 $$.new_type_flag = $1.new_type_flag; }
1861 | typespec reserved_typespecquals reserved_declspecs
1862 { $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1863 $$.new_type_flag = $1.new_type_flag; }
1864 | declmods typespec reserved_declspecs
1865 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1866 $$.new_type_flag = $2.new_type_flag; }
1867 | declmods typespec reserved_typespecquals
1868 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1869 $$.new_type_flag = $2.new_type_flag; }
1870 | declmods typespec reserved_typespecquals reserved_declspecs
1871 { $$.t = tree_cons (NULL_TREE, $2.t,
1872 chainon ($3, chainon ($4, $1.t)));
1873 $$.new_type_flag = $2.new_type_flag; }
1878 { if (extra_warnings)
1879 warning ("`%s' is not at beginning of declaration",
1880 IDENTIFIER_POINTER ($$));
1881 $$ = build_tree_list (NULL_TREE, $$); }
1882 | reserved_declspecs typespecqual_reserved
1883 { $$ = tree_cons (NULL_TREE, $2.t, $$); }
1884 | reserved_declspecs SCSPEC
1885 { if (extra_warnings)
1886 warning ("`%s' is not at beginning of declaration",
1887 IDENTIFIER_POINTER ($2));
1888 $$ = tree_cons (NULL_TREE, $2, $$); }
1889 | reserved_declspecs attributes
1890 { $$ = tree_cons ($2, NULL_TREE, $1); }
1892 { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
1895 /* List of just storage classes and type modifiers.
1896 A declaration can start with just this, but then it cannot be used
1897 to redeclare a typedef-name.
1898 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1900 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1901 up on a persistent obstack. Otherwise, they could appear at the
1902 beginning of something like
1904 static const struct { int foo () { } } b;
1906 and would be discarded after we finish compiling foo. We don't need to
1907 worry once we see a type. */
1910 nonempty_cv_qualifiers %prec EMPTY
1911 { $$.lookups = NULL_TREE; TREE_STATIC ($$.t) = 1; }
1914 $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1915 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1917 | declmods CV_QUALIFIER
1919 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1920 TREE_STATIC ($$.t) = 1;
1924 if (extra_warnings && TREE_STATIC ($$.t))
1925 warning ("`%s' is not at beginning of declaration",
1926 IDENTIFIER_POINTER ($2));
1927 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1928 TREE_STATIC ($$.t) = TREE_STATIC ($1.t);
1930 | declmods attributes
1931 { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t); }
1932 | attributes %prec EMPTY
1934 $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE);
1935 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1939 /* Used instead of declspecs where storage classes are not allowed
1940 (that is, for typenames and structure components).
1942 C++ can takes storage classes for structure components.
1943 Don't accept a typedef-name if anything but a modifier precedes it. */
1946 typespec %prec EMPTY
1947 { $$.t = build_tree_list (NULL_TREE, $1.t);
1948 $$.new_type_flag = $1.new_type_flag; }
1949 | nonempty_cv_qualifiers typespec
1950 { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
1951 $$.new_type_flag = $2.new_type_flag; }
1952 | typespec reserved_typespecquals
1953 { $$.t = tree_cons (NULL_TREE, $1.t, $2);
1954 $$.new_type_flag = $1.new_type_flag; }
1955 | nonempty_cv_qualifiers typespec reserved_typespecquals
1956 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1957 $$.new_type_flag = $2.new_type_flag; }
1960 reserved_typespecquals:
1961 typespecqual_reserved
1962 { $$ = build_tree_list (NULL_TREE, $1.t); }
1963 | reserved_typespecquals typespecqual_reserved
1964 { $$ = tree_cons (NULL_TREE, $2.t, $1); }
1967 /* A typespec (but not a type qualifier).
1968 Once we have seen one of these in a declaration,
1969 if a typedef name appears then it is being redeclared. */
1973 { $$.lookups = NULL_TREE; }
1974 | TYPESPEC %prec EMPTY
1975 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1976 | complete_type_name
1977 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1978 | TYPEOF '(' expr ')'
1979 { $$.t = finish_typeof ($3);
1980 $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1981 | TYPEOF '(' type_id ')'
1982 { $$.t = groktypename ($3.t);
1983 $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
1984 | SIGOF '(' expr ')'
1985 { tree type = TREE_TYPE ($3);
1987 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1988 if (IS_AGGR_TYPE (type))
1990 sorry ("sigof type specifier");
1995 error ("`sigof' applied to non-aggregate expression");
1996 $$.t = error_mark_node;
1999 | SIGOF '(' type_id ')'
2000 { tree type = groktypename ($3.t);
2002 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2003 if (IS_AGGR_TYPE (type))
2005 sorry ("sigof type specifier");
2010 error("`sigof' applied to non-aggregate type");
2011 $$.t = error_mark_node;
2016 /* A typespec that is a reserved word, or a type qualifier. */
2018 typespecqual_reserved:
2020 { $$.t = $1; $$.new_type_flag = 0; }
2022 { $$.t = $1; $$.new_type_flag = 0; }
2028 | initdecls ',' initdcl
2029 { check_multiple_declarators (); }
2034 | notype_initdecls ',' initdcl
2035 { check_multiple_declarators (); }
2040 | nomods_initdecls ',' initdcl
2041 { check_multiple_declarators (); }
2047 | asm_keyword '(' string ')'
2048 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
2052 declarator maybeasm maybe_attribute '='
2053 { $<ttype>$ = parse_decl ($<ttype>1, $3, 1); }
2055 /* Note how the declaration of the variable is in effect while its init is parsed! */
2056 { parse_end_decl ($<ttype>5, $6, $2); }
2057 | declarator maybeasm maybe_attribute
2059 $<ttype>$ = parse_decl ($<ttype>1, $3, 0);
2060 parse_end_decl ($<ttype>$, NULL_TREE, $2);
2064 /* This rule assumes a certain configuration of the parser stack.
2065 In particular, $0, the element directly before the beginning of
2066 this rule on the stack, must be a maybeasm. $-1 must be a
2067 declarator or notype_declarator. And $-2 must be some declmods
2068 or declspecs. We can't move the maybeasm into this rule because
2069 we need that reduce so we prefer fn.def1 when appropriate. */
2072 { $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
2073 $<ftype>-2.lookups, $1, 1); }
2074 /* Note how the declaration of the variable is in effect
2075 while its init is parsed! */
2077 { parse_end_decl ($<ttype>3, $4, $<ttype>0); }
2079 { tree d = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
2080 $<ftype>-2.lookups, $1, 0);
2081 parse_end_decl (d, NULL_TREE, $<ttype>0); }
2085 declarator maybeasm initdcl0_innards
2090 notype_declarator maybeasm initdcl0_innards
2095 notype_declarator maybeasm
2096 { /* Set things up as initdcl0_innards expects. */
2099 $<ftype>1.t = NULL_TREE;
2100 $<ftype>1.lookups = NULL_TREE; }
2103 | constructor_declarator maybeasm maybe_attribute
2104 { tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0);
2105 parse_end_decl (d, NULL_TREE, $2); }
2108 /* the * rules are dummies to accept the Apollo extended syntax
2109 so that the header files compile. */
2120 | attributes attribute
2121 { $$ = chainon ($1, $2); }
2125 ATTRIBUTE '(' '(' attribute_list ')' ')'
2132 | attribute_list ',' attrib
2133 { $$ = chainon ($1, $3); }
2140 { $$ = build_tree_list ($1, NULL_TREE); }
2141 | any_word '(' IDENTIFIER ')'
2142 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2143 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2144 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2145 | any_word '(' nonnull_exprlist ')'
2146 { $$ = build_tree_list ($1, $3); }
2149 /* This still leaves out most reserved keywords,
2150 shouldn't we include them? */
2159 /* A nonempty list of identifiers, including typenames. */
2160 identifiers_or_typenames:
2162 { $$ = build_tree_list (NULL_TREE, $1); }
2163 | identifiers_or_typenames ',' identifier
2164 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2168 /* empty */ %prec EMPTY
2173 /* If we are processing a template, we don't want to expand this
2177 expr_no_commas %prec '='
2179 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2180 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2182 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2183 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2184 | '{' initlist ',' '}'
2185 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2186 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2191 /* This chain is built in reverse order,
2192 and put in forward order where initlist is used. */
2195 { $$ = build_tree_list (NULL_TREE, $$); }
2197 { $$ = tree_cons (NULL_TREE, $3, $$); }
2198 /* These are for labeled elements. */
2199 | '[' expr_no_commas ']' init
2200 { $$ = build_tree_list ($2, $4); }
2201 | identifier ':' init
2202 { $$ = build_tree_list ($$, $3); }
2203 | initlist ',' identifier ':' init
2204 { $$ = tree_cons ($3, $5, $$); }
2208 PRE_PARSED_FUNCTION_DECL maybe_return_init ctor_initializer_opt compstmt_or_error
2210 expand_body (finish_function ((int)$3 | 2));
2211 process_next_inline ($1);
2213 | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
2215 expand_body (finish_function ((int)$3 | 2));
2216 process_next_inline ($1);
2218 | PRE_PARSED_FUNCTION_DECL maybe_return_init error
2220 finish_function (2);
2221 process_next_inline ($1); }
2226 | pending_inlines pending_inline eat_saved_input
2229 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2230 the TREE_LIST node for the parameter in question. */
2232 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2233 { replace_defarg ($1, $2); }
2234 | DEFARG_MARKER error END_OF_SAVED_INPUT
2235 { replace_defarg ($1, error_mark_node); }
2238 /* empty */ %prec EMPTY
2239 | pending_defargs defarg_again
2240 { do_pending_defargs (); }
2241 | pending_defargs error
2242 { do_pending_defargs (); }
2247 { $<ttype>$ = current_enum_type;
2248 current_enum_type = start_enum ($2); }
2250 { $$.t = current_enum_type;
2251 finish_enum (current_enum_type);
2252 $$.new_type_flag = 1;
2253 current_enum_type = $<ttype>4;
2254 check_for_missing_semicolon ($$.t); }
2256 { $<ttype>$ = current_enum_type;
2257 current_enum_type = start_enum (make_anon_name ()); }
2259 { $$.t = current_enum_type;
2260 finish_enum (current_enum_type);
2261 $$.new_type_flag = 1;
2262 current_enum_type = $<ttype>3;
2263 check_for_missing_semicolon ($$.t); }
2265 { $$.t = xref_tag (enum_type_node, $2, 1);
2266 $$.new_type_flag = 0; }
2267 | ENUM complex_type_name
2268 { $$.t = xref_tag (enum_type_node, $2, 1);
2269 $$.new_type_flag = 0; }
2270 | TYPENAME_KEYWORD typename_sub
2272 $$.new_type_flag = 0;
2273 if (!processing_template_decl)
2274 cp_pedwarn ("using `typename' outside of template"); }
2275 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2277 { $1.t = begin_class_definition ($1.t);
2278 current_aggr = NULL_TREE; }
2279 opt.component_decl_list '}' maybe_attribute
2284 if (yychar == YYEMPTY)
2286 semi = yychar == ';';
2288 t = finish_class_definition ($1.t, $6, semi,
2292 /* restore current_aggr */
2293 current_aggr = TREE_CODE (t) != RECORD_TYPE
2295 : CLASSTYPE_DECLARED_CLASS (t)
2296 ? class_type_node : record_type_node;
2300 done_pending_defargs ();
2301 begin_inline_definitions ();
2305 finish_inline_definitions ();
2307 $$.new_type_flag = 1;
2309 | class_head %prec EMPTY
2311 if ($1.new_type_flag && $1.t != error_mark_node)
2312 pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL ($1.t)));
2313 $$.new_type_flag = 0;
2314 if ($1.t == error_mark_node)
2316 else if (TYPE_BINFO ($1.t) == NULL_TREE)
2318 cp_error ("%T is not a class type", $1.t);
2319 $$.t = error_mark_node;
2324 /* struct B: public A; is not accepted by the standard grammar. */
2325 if (CLASS_TYPE_P ($$.t)
2326 && TYPE_BINFO_BASETYPES ($$.t)
2327 && !COMPLETE_TYPE_P ($$.t)
2328 && ! TYPE_BEING_DEFINED ($$.t))
2329 cp_error ("base clause without member specification for `%#T'",
2343 { if (pedantic && !in_system_header)
2344 pedwarn ("comma at end of enumerator list"); }
2350 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2352 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2354 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2356 { error ("no body nor ';' separates two class, struct or union declarations"); }
2358 { $$ = build_tree_list ($2, $1); }
2361 named_class_head_sans_basetype:
2369 named_class_head_sans_basetype_defn:
2370 aggr identifier_defn %prec EMPTY
2371 { current_aggr = $$; $$ = $2; }
2372 | named_class_head_sans_basetype '{'
2373 { yyungetc ('{', 1); }
2374 | named_class_head_sans_basetype ':'
2375 { yyungetc (':', 1); }
2378 named_complex_class_head_sans_basetype:
2379 aggr nested_name_specifier identifier
2382 $$.t = handle_class_head ($1, $2, $3);
2383 $$.new_type_flag = 1;
2385 | aggr global_scope nested_name_specifier identifier
2388 $$.t = handle_class_head ($1, $3, $4);
2389 $$.new_type_flag = 1;
2391 | aggr global_scope identifier
2394 $$.t = handle_class_head ($1, NULL_TREE, $3);
2395 $$.new_type_flag = 1;
2397 | aggr apparent_template_type
2401 $$.new_type_flag = 0;
2403 | aggr nested_name_specifier apparent_template_type
2407 push_scope (CP_DECL_CONTEXT ($$.t));
2408 $$.new_type_flag = 1;
2413 named_class_head_sans_basetype %prec EMPTY
2415 $$.t = xref_tag (current_aggr, $1, 1);
2416 $$.new_type_flag = 0;
2418 | named_class_head_sans_basetype_defn
2419 { $<ttype>$ = xref_tag (current_aggr, $1, 0); }
2420 /* Class name is unqualified, so we look for base classes
2421 in the current scope. */
2422 maybe_base_class_list %prec EMPTY
2425 $$.new_type_flag = 0;
2427 xref_basetypes (current_aggr, $1, $<ttype>2, $3);
2429 | named_complex_class_head_sans_basetype
2430 maybe_base_class_list
2432 if ($1.t != error_mark_node)
2434 tree type = TREE_TYPE ($1.t);
2437 $$.new_type_flag = $1.new_type_flag;
2438 if ((current_aggr == union_type_node)
2439 != (TREE_CODE (type) == UNION_TYPE))
2440 cp_pedwarn (current_aggr == union_type_node
2441 ? "`union' tag used in declaring `%#T'"
2442 : "non-`union' tag used in declaring `%#T'",
2444 else if (TREE_CODE (type) == RECORD_TYPE)
2445 /* We might be specializing a template with a different
2447 CLASSTYPE_DECLARED_CLASS (type)
2448 = (current_aggr == class_type_node);
2451 if (TREE_CODE (type) == TYPENAME_TYPE)
2452 /* In a definition of a member class template, we
2453 will get here with an implicit typename, a
2454 TYPENAME_TYPE with a type. */
2455 type = TREE_TYPE (type);
2456 maybe_process_partial_specialization (type);
2457 xref_basetypes (current_aggr, $1.t, type, $2);
2465 { $$ = xref_tag ($$, make_anon_name (), 0);
2466 yyungetc ('{', 1); }
2469 /* The tree output of this nonterminal a declarationf or the type
2470 named. If NEW_TYPE_FLAG is set, then the name used in this
2471 class-head was explicitly qualified, e.g.: `struct X::Y'. We have
2472 already called push_scope for X. */
2477 $$.new_type_flag = 0;
2482 maybe_base_class_list:
2483 /* empty */ %prec EMPTY
2485 | ':' see_typename %prec EMPTY
2486 { yyungetc(':', 1); $$ = NULL_TREE; }
2487 | ':' see_typename base_class_list %prec EMPTY
2493 | base_class_list ',' see_typename base_class
2494 { $$ = chainon ($$, $4); }
2499 { $$ = finish_base_specifier (access_default_node, $1); }
2500 | base_class_access_list see_typename base_class.1
2501 { $$ = finish_base_specifier ($1, $3); }
2507 $$ = error_mark_node; }
2509 { $$ = TREE_TYPE ($$); }
2512 base_class_access_list:
2513 VISSPEC see_typename
2514 | SCSPEC see_typename
2515 { if ($1 != ridpointers[(int)RID_VIRTUAL])
2516 cp_error ("`%D' access", $1);
2517 $$ = access_default_virtual_node; }
2518 | base_class_access_list VISSPEC see_typename
2520 if ($1 != access_default_virtual_node)
2521 error ("multiple access specifiers");
2522 else if ($2 == access_public_node)
2523 $$ = access_public_virtual_node;
2524 else if ($2 == access_protected_node)
2525 $$ = access_protected_virtual_node;
2526 else /* $2 == access_private_node */
2527 $$ = access_private_virtual_node;
2529 | base_class_access_list SCSPEC see_typename
2530 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2531 cp_error ("`%D' access", $2);
2532 else if ($$ == access_public_node)
2533 $$ = access_public_virtual_node;
2534 else if ($$ == access_protected_node)
2535 $$ = access_protected_virtual_node;
2536 else if ($$ == access_private_node)
2537 $$ = access_private_virtual_node;
2539 error ("multiple `virtual' specifiers");
2543 opt.component_decl_list:
2544 | component_decl_list
2545 | opt.component_decl_list access_specifier component_decl_list
2546 | opt.component_decl_list access_specifier
2552 current_access_specifier = $1;
2556 /* Note: we no longer warn about the semicolon after a component_decl_list.
2557 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2558 component_decl_list:
2561 finish_member_declaration ($1);
2562 current_aggr = NULL_TREE;
2563 reset_type_access_control ();
2565 | component_decl_list component_decl
2567 finish_member_declaration ($2);
2568 current_aggr = NULL_TREE;
2569 reset_type_access_control ();
2574 component_decl_1 ';'
2575 | component_decl_1 '}'
2576 { error ("missing ';' before right brace");
2577 yyungetc ('}', 0); }
2578 /* C++: handle constructors, destructors and inline functions */
2579 /* note that INLINE is like a TYPESPEC */
2580 | fn.def2 ':' /* base_init compstmt */
2581 { $$ = finish_method ($$); }
2582 | fn.def2 TRY /* base_init compstmt */
2583 { $$ = finish_method ($$); }
2584 | fn.def2 RETURN_KEYWORD /* base_init compstmt */
2585 { $$ = finish_method ($$); }
2586 | fn.def2 '{' /* nodecls compstmt */
2587 { $$ = finish_method ($$); }
2590 | extension component_decl
2593 | template_header component_decl
2596 $$ = finish_member_template_decl ($2);
2598 /* The component was already processed. */
2601 finish_template_decl ($1);
2603 | template_header typed_declspecs ';'
2605 $$ = finish_member_class_template ($2.t);
2606 finish_template_decl ($1);
2613 /* Do not add a "typed_declspecs declarator" rule here for
2614 speed; we need to call grok_x_components for enums, so the
2615 speedup would be insignificant. */
2616 typed_declspecs components
2618 /* Most of the productions for component_decl only
2619 allow the creation of one new member, so we call
2620 finish_member_declaration in component_decl_list.
2621 For this rule and the next, however, there can be
2622 more than one member, e.g.:
2626 and we need the first member to be fully
2627 registered before the second is processed.
2628 Therefore, the rules for components take care of
2629 this processing. To avoid registering the
2630 components more than once, we send NULL_TREE up
2631 here; that lets finish_member_declaration know
2632 that there is nothing to do. */
2634 grok_x_components ($1.t);
2637 | declmods notype_components
2640 grok_x_components ($1.t);
2643 | notype_declarator maybeasm maybe_attribute maybe_init
2644 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2645 | constructor_declarator maybeasm maybe_attribute maybe_init
2646 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2647 | ':' expr_no_commas
2648 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2652 /* These rules introduce a reduce/reduce conflict; in
2653 typedef int foo, bar;
2657 should "A::foo" be declared as a function or "A::bar" as a data
2658 member? In other words, is "bar" an after_type_declarator or a
2660 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2661 { tree specs, attrs;
2662 split_specs_attrs ($1.t, &specs, &attrs);
2663 $$ = grokfield ($2, specs, $5, $3,
2664 chainon ($4, attrs)); }
2665 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2666 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2668 { $$ = do_class_using_decl ($1); }
2670 /* The case of exactly one component is handled directly by component_decl. */
2673 /* empty: possibly anonymous */
2675 | component_declarator0
2677 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2678 $1 = finish_member_template_decl ($1);
2679 finish_member_declaration ($1);
2682 | components ',' component_declarator
2684 check_multiple_declarators ();
2685 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2686 $3 = finish_member_template_decl ($3);
2687 finish_member_declaration ($3);
2693 /* empty: possibly anonymous */
2695 | notype_component_declarator0
2697 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2698 $1 = finish_member_template_decl ($1);
2699 finish_member_declaration ($1);
2702 | notype_components ',' notype_component_declarator
2704 check_multiple_declarators ();
2705 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2706 $3 = finish_member_template_decl ($3);
2707 finish_member_declaration ($3);
2712 component_declarator0:
2713 after_type_component_declarator0
2714 | notype_component_declarator0
2717 component_declarator:
2718 after_type_component_declarator
2719 | notype_component_declarator
2722 after_type_component_declarator0:
2723 after_type_declarator maybeasm maybe_attribute maybe_init
2724 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2726 | TYPENAME ':' expr_no_commas maybe_attribute
2727 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2731 notype_component_declarator0:
2732 notype_declarator maybeasm maybe_attribute maybe_init
2733 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2735 | constructor_declarator maybeasm maybe_attribute maybe_init
2736 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2738 | IDENTIFIER ':' expr_no_commas maybe_attribute
2739 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2741 | ':' expr_no_commas maybe_attribute
2742 { $$ = parse_bitfield0 (NULL_TREE, $<ftype>0.t,
2743 $<ftype>0.lookups, $3, $2); }
2746 after_type_component_declarator:
2747 after_type_declarator maybeasm maybe_attribute maybe_init
2748 { $$ = parse_field ($1, $3, $2, $4); }
2749 | TYPENAME ':' expr_no_commas maybe_attribute
2750 { $$ = parse_bitfield ($1, $4, $3); }
2753 notype_component_declarator:
2754 notype_declarator maybeasm maybe_attribute maybe_init
2755 { $$ = parse_field ($1, $3, $2, $4); }
2756 | IDENTIFIER ':' expr_no_commas maybe_attribute
2757 { $$ = parse_bitfield ($1, $4, $3); }
2758 | ':' expr_no_commas maybe_attribute
2759 { $$ = parse_bitfield (NULL_TREE, $3, $2); }
2763 enumlist maybecomma_warn
2767 /* We chain the enumerators in reverse order.
2768 Because of the way enums are built, the order is
2769 insignificant. Take advantage of this fact. */
2773 | enumlist ',' enumerator
2778 { build_enumerator ($1, NULL_TREE, current_enum_type); }
2779 | identifier '=' expr_no_commas
2780 { build_enumerator ($1, $3, current_enum_type); }
2783 /* ISO new-type-id (5.3.4) */
2785 type_specifier_seq new_declarator
2786 { $$.t = build_tree_list ($1.t, $2);
2787 $$.new_type_flag = $1.new_type_flag; }
2788 | type_specifier_seq %prec EMPTY
2789 { $$.t = build_tree_list ($1.t, NULL_TREE);
2790 $$.new_type_flag = $1.new_type_flag; }
2791 /* GNU extension to allow arrays of arbitrary types with
2792 non-constant dimension. */
2793 | '(' type_id ')' '[' expr ']'
2796 pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new");
2797 $$.t = build_nt (ARRAY_REF, TREE_VALUE ($2.t), $5);
2798 $$.t = build_tree_list (TREE_PURPOSE ($2.t), $$.t);
2799 $$.new_type_flag = $2.new_type_flag;
2804 /* empty */ %prec EMPTY
2806 | cv_qualifiers CV_QUALIFIER
2807 { $$ = tree_cons (NULL_TREE, $2, $$); }
2810 nonempty_cv_qualifiers:
2812 { $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
2813 $$.new_type_flag = 0; }
2814 | nonempty_cv_qualifiers CV_QUALIFIER
2815 { $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
2816 $$.new_type_flag = $1.new_type_flag; }
2819 /* These rules must follow the rules for function declarations
2820 and component declarations. That way, longer rules are preferred. */
2822 /* An expression which will not live on the momentary obstack. */
2824 '(' nonnull_exprlist ')'
2829 { $$ = empty_parms (); }
2834 /* A declarator that is allowed only after an explicit typespec. */
2836 after_type_declarator_intern:
2837 after_type_declarator
2838 | attributes after_type_declarator
2840 /* Provide support for '(' attributes '*' declarator ')'
2842 $$ = tree_cons ($1, $2, NULL_TREE);
2846 /* may all be followed by prec '.' */
2847 after_type_declarator:
2848 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2849 { $$ = make_pointer_declarator ($2.t, $3); }
2850 | '&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2851 { $$ = make_reference_declarator ($2.t, $3); }
2852 | '*' after_type_declarator_intern %prec UNARY
2853 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2854 | '&' after_type_declarator_intern %prec UNARY
2855 { $$ = make_reference_declarator (NULL_TREE, $2); }
2856 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2857 { tree arg = make_pointer_declarator ($2, $3);
2858 $$ = build_nt (SCOPE_REF, $1, arg);
2860 | direct_after_type_declarator
2863 direct_after_type_declarator:
2864 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2865 { $$ = make_call_declarator ($$, $2, $3, $4); }
2866 | direct_after_type_declarator '[' expr ']'
2867 { $$ = build_nt (ARRAY_REF, $$, $3); }
2868 | direct_after_type_declarator '[' ']'
2869 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
2870 | '(' after_type_declarator_intern ')'
2872 | nested_name_specifier type_name %prec EMPTY
2873 { push_nested_class ($1, 3);
2874 $$ = build_nt (SCOPE_REF, $$, $2);
2875 TREE_COMPLEXITY ($$) = current_class_depth; }
2876 | type_name %prec EMPTY
2880 type_name %prec EMPTY
2882 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2884 $$ = lookup_name ($1, 1);
2885 maybe_note_name_used_in_class ($1, $$);
2890 | global_scope type_name
2892 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2893 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
2896 got_scope = NULL_TREE;
2903 | global_scope nested_type
2908 nested_name_specifier type_name %prec EMPTY
2909 { $$ = get_type_decl ($2); }
2912 /* A declarator allowed whether or not there has been
2913 an explicit typespec. These cannot redeclare a typedef-name. */
2915 notype_declarator_intern:
2917 | attributes notype_declarator
2919 /* Provide support for '(' attributes '*' declarator ')'
2921 $$ = tree_cons ($1, $2, NULL_TREE);
2926 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2927 { $$ = make_pointer_declarator ($2.t, $3); }
2928 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2929 { $$ = make_reference_declarator ($2.t, $3); }
2930 | '*' notype_declarator_intern %prec UNARY
2931 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2932 | '&' notype_declarator_intern %prec UNARY
2933 { $$ = make_reference_declarator (NULL_TREE, $2); }
2934 | ptr_to_mem cv_qualifiers notype_declarator_intern
2935 { tree arg = make_pointer_declarator ($2, $3);
2936 $$ = build_nt (SCOPE_REF, $1, arg);
2938 | direct_notype_declarator
2941 complex_notype_declarator:
2942 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2943 { $$ = make_pointer_declarator ($2.t, $3); }
2944 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2945 { $$ = make_reference_declarator ($2.t, $3); }
2946 | '*' complex_notype_declarator %prec UNARY
2947 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2948 | '&' complex_notype_declarator %prec UNARY
2949 { $$ = make_reference_declarator (NULL_TREE, $2); }
2950 | ptr_to_mem cv_qualifiers notype_declarator_intern
2951 { tree arg = make_pointer_declarator ($2, $3);
2952 $$ = build_nt (SCOPE_REF, $1, arg);
2954 | complex_direct_notype_declarator
2957 complex_direct_notype_declarator:
2958 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2959 { $$ = make_call_declarator ($$, $2, $3, $4); }
2960 | '(' complex_notype_declarator ')'
2962 | direct_notype_declarator '[' expr ']'
2963 { $$ = build_nt (ARRAY_REF, $$, $3); }
2964 | direct_notype_declarator '[' ']'
2965 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
2966 | notype_qualified_id
2967 { enter_scope_of ($1); }
2968 | global_scope notype_qualified_id
2969 { enter_scope_of ($2); $$ = $2;}
2970 | global_scope notype_unqualified_id
2971 { $$ = build_nt (SCOPE_REF, global_namespace, $2);
2972 enter_scope_of ($$);
2974 | nested_name_specifier notype_template_declarator
2975 { got_scope = NULL_TREE;
2976 $$ = build_nt (SCOPE_REF, $1, $2);
2977 enter_scope_of ($$);
2982 nested_name_specifier unqualified_id
2983 { got_scope = NULL_TREE;
2984 $$ = build_nt (SCOPE_REF, $$, $2); }
2985 | nested_name_specifier object_template_id
2986 { got_scope = NULL_TREE;
2987 $$ = build_nt (SCOPE_REF, $1, $2); }
2990 notype_qualified_id:
2991 nested_name_specifier notype_unqualified_id
2992 { got_scope = NULL_TREE;
2993 $$ = build_nt (SCOPE_REF, $$, $2); }
2994 | nested_name_specifier object_template_id
2995 { got_scope = NULL_TREE;
2996 $$ = build_nt (SCOPE_REF, $1, $2); }
3001 | global_scope notype_qualified_id
3006 typespec '(' nonnull_exprlist ')'
3007 { $$ = build_functional_cast ($1.t, $3); }
3008 | typespec '(' expr_or_declarator_intern ')'
3009 { $$ = reparse_decl_as_expr ($1.t, $3); }
3010 | typespec fcast_or_absdcl %prec EMPTY
3011 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3017 | template_type %prec EMPTY
3020 nested_name_specifier:
3021 nested_name_specifier_1
3022 | nested_name_specifier nested_name_specifier_1
3024 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
3026 = make_typename_type ($1, $3, /*complain=*/1); }
3029 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3030 inline here?!? (jason) */
3031 nested_name_specifier_1:
3034 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3037 maybe_note_name_used_in_class ($1, $$);
3040 complete_type (TYPE_MAIN_VARIANT (TREE_TYPE ($$)));
3044 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3046 got_scope = $$ = TREE_TYPE ($$);
3050 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3054 | template_type SCOPE
3055 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3056 /* These break 'const i;'
3060 cp_error ("`%D' is not an aggregate typedef",
3061 lastiddecl ? lastiddecl : $$);
3062 $$ = error_mark_node;
3065 { goto failed_scope; } */
3070 | global_scope typename_sub0
3075 typename_sub1 identifier %prec EMPTY
3078 $$ = make_typename_type ($1, $2, /*complain=*/1);
3079 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
3080 cp_error ("`%T' is not a class or namespace", $2);
3084 if (TREE_CODE ($$) == TYPE_DECL)
3085 $$ = TREE_TYPE ($$);
3088 | typename_sub1 template_type %prec EMPTY
3089 { $$ = TREE_TYPE ($2); }
3090 | typename_sub1 explicit_template_type %prec EMPTY
3091 { $$ = make_typename_type ($1, $2, /*complain=*/1); }
3092 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
3093 { $$ = make_typename_type ($1, $3, /*complain=*/1); }
3099 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3100 cp_error ("`%T' is not a class or namespace", $1);
3101 else if (TREE_CODE ($1) == TYPE_DECL)
3102 $$ = TREE_TYPE ($1);
3104 | typename_sub1 typename_sub2
3107 $$ = make_typename_type ($1, $2, /*complain=*/1);
3108 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
3109 cp_error ("`%T' is not a class or namespace", $2);
3113 if (TREE_CODE ($$) == TYPE_DECL)
3114 $$ = TREE_TYPE ($$);
3117 | typename_sub1 explicit_template_type SCOPE
3119 = make_typename_type ($1, $2, /*complain=*/1); }
3120 | typename_sub1 TEMPLATE explicit_template_type SCOPE
3122 = make_typename_type ($1, $3, /*complain=*/1); }
3125 /* This needs to return a TYPE_DECL for simple names so that we don't
3126 forget what name was used. */
3130 if (TREE_CODE ($1) != TYPE_DECL)
3133 /* Retrieve the type for the identifier, which might involve
3134 some computation. */
3135 got_scope = complete_type (TREE_TYPE ($$));
3137 if ($$ == error_mark_node)
3138 cp_error ("`%T' is not a class or namespace", $1);
3142 if (TREE_CODE ($1) != TYPE_DECL)
3144 got_scope = complete_type (TREE_TYPE ($$));
3146 | template_type SCOPE
3147 { got_scope = $$ = complete_type (TREE_TYPE ($$)); }
3152 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3158 explicit_template_type:
3159 identifier '<' template_arg_list_opt template_close_bracket
3160 { $$ = build_min_nt (TEMPLATE_ID_EXPR, $1, $3); }
3164 global_scope type_name
3166 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3167 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
3170 got_scope = NULL_TREE;
3173 | global_scope nested_type
3178 nested_name_specifier '*'
3179 { got_scope = NULL_TREE; }
3180 | global_scope nested_name_specifier '*'
3181 { $$ = $2; got_scope = NULL_TREE; }
3184 /* All uses of explicit global scope must go through this nonterminal so
3185 that got_scope will be set before yylex is called to get the next token. */
3188 { got_scope = void_type_node; }
3191 /* ISO new-declarator (5.3.4) */
3193 '*' cv_qualifiers new_declarator
3194 { $$ = make_pointer_declarator ($2, $3); }
3195 | '*' cv_qualifiers %prec EMPTY
3196 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3197 | '&' cv_qualifiers new_declarator %prec EMPTY
3198 { $$ = make_reference_declarator ($2, $3); }
3199 | '&' cv_qualifiers %prec EMPTY
3200 { $$ = make_reference_declarator ($2, NULL_TREE); }
3201 | ptr_to_mem cv_qualifiers %prec EMPTY
3202 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3203 $$ = build_nt (SCOPE_REF, $1, arg);
3205 | ptr_to_mem cv_qualifiers new_declarator
3206 { tree arg = make_pointer_declarator ($2, $3);
3207 $$ = build_nt (SCOPE_REF, $1, arg);
3209 | direct_new_declarator %prec EMPTY
3212 /* ISO direct-new-declarator (5.3.4) */
3213 direct_new_declarator:
3215 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
3216 | direct_new_declarator '[' expr ']'
3217 { $$ = build_nt (ARRAY_REF, $$, $3); }
3224 /* Provide support for '(' attributes '*' declarator ')'
3226 $$ = tree_cons ($1, $2, NULL_TREE);
3230 /* ISO abstract-declarator (8.1) */
3232 '*' nonempty_cv_qualifiers absdcl_intern
3233 { $$ = make_pointer_declarator ($2.t, $3); }
3235 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3236 | '*' nonempty_cv_qualifiers %prec EMPTY
3237 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3239 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3240 | '&' nonempty_cv_qualifiers absdcl_intern
3241 { $$ = make_reference_declarator ($2.t, $3); }
3243 { $$ = make_reference_declarator (NULL_TREE, $2); }
3244 | '&' nonempty_cv_qualifiers %prec EMPTY
3245 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3247 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3248 | ptr_to_mem cv_qualifiers %prec EMPTY
3249 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3250 $$ = build_nt (SCOPE_REF, $1, arg);
3252 | ptr_to_mem cv_qualifiers absdcl_intern
3253 { tree arg = make_pointer_declarator ($2, $3);
3254 $$ = build_nt (SCOPE_REF, $1, arg);
3256 | direct_abstract_declarator %prec EMPTY
3259 /* ISO direct-abstract-declarator (8.1) */
3260 direct_abstract_declarator:
3261 '(' absdcl_intern ')'
3263 /* `(typedef)1' is `int'. */
3264 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3265 { $$ = make_call_declarator ($$, $3, $5, $6); }
3266 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3267 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3268 | direct_abstract_declarator '[' expr ']' %prec '.'
3269 { $$ = build_nt (ARRAY_REF, $$, $3); }
3270 | direct_abstract_declarator '[' ']' %prec '.'
3271 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
3272 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3273 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3274 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3275 { set_quals_and_spec ($$, $2, $3); }
3276 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3277 { set_quals_and_spec ($$, $2, $3); }
3278 | '[' expr ']' %prec '.'
3279 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
3281 { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
3284 /* For C++, decls and stmts can be intermixed, so we don't need to
3285 have a special rule that won't start parsing the stmt section
3286 until we have a stmt that parses without errors. */
3299 /* Read zero or more forward-declarations for labels
3300 that nested functions can jump to. */
3305 pedwarn ("ISO C++ forbids label declarations"); }
3310 | label_decls label_decl
3314 LABEL identifiers_or_typenames ';'
3318 finish_label_decl (TREE_VALUE ($2));
3319 $2 = TREE_CHAIN ($2);
3324 /* This is the body of a function definition.
3325 It causes syntax errors to ignore to the next openbrace. */
3333 { $<ttype>$ = begin_compound_stmt (0); }
3335 { STMT_LINENO ($<ttype>3) = $1;
3336 finish_compound_stmt (0, $<ttype>3); }
3341 { $<ttype>$ = begin_if_stmt ();
3342 cond_stmt_keyword = "if"; }
3344 { finish_if_stmt_cond ($3, $<ttype>2); }
3345 implicitly_scoped_stmt
3347 finish_then_clause ($<ttype>2); }
3350 implicitly_scoped_stmt:
3353 { $<ttype>$ = begin_compound_stmt (0); }
3354 save_lineno simple_stmt
3355 { STMT_LINENO ($<ttype>1) = $2;
3356 if ($3) STMT_LINENO ($3) = $2;
3357 finish_compound_stmt (0, $<ttype>1); }
3362 | save_lineno simple_stmt
3363 { if ($2) STMT_LINENO ($2) = $1; }
3371 { $$ = finish_expr_stmt ($1); }
3373 { begin_else_clause (); }
3374 implicitly_scoped_stmt
3377 finish_else_clause ($1);
3380 | simple_if %prec IF
3382 finish_if_stmt (); }
3385 $<ttype>$ = begin_while_stmt ();
3386 cond_stmt_keyword = "while";
3389 { finish_while_stmt_cond ($3, $<ttype>2); }
3392 finish_while_stmt ($<ttype>2); }
3394 { $<ttype>$ = begin_do_stmt (); }
3395 implicitly_scoped_stmt WHILE
3397 finish_do_body ($<ttype>2);
3398 cond_stmt_keyword = "do";
3400 paren_expr_or_null ';'
3402 finish_do_stmt ($6, $<ttype>2); }
3404 { $<ttype>$ = begin_for_stmt (); }
3405 '(' for.init.statement
3406 { finish_for_init_stmt ($<ttype>2); }
3408 { finish_for_cond ($6, $<ttype>2); }
3410 { finish_for_expr ($9, $<ttype>2); }
3413 finish_for_stmt ($<ttype>2); }
3415 { $<ttype>$ = begin_switch_stmt (); }
3417 { finish_switch_cond ($4, $<ttype>2); }
3418 implicitly_scoped_stmt
3420 finish_switch_stmt ($<ttype>2); }
3421 | CASE expr_no_commas ':'
3422 { $<ttype>$ = finish_case_label ($2, NULL_TREE); }
3425 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3426 { $<ttype>$ = finish_case_label ($2, $4); }
3430 { $<ttype>$ = finish_case_label (NULL_TREE, NULL_TREE); }
3434 { $$ = finish_break_stmt (); }
3436 { $$ = finish_continue_stmt (); }
3437 | RETURN_KEYWORD ';'
3438 { $$ = finish_return_stmt (NULL_TREE); }
3439 | RETURN_KEYWORD expr ';'
3440 { $$ = finish_return_stmt ($2); }
3441 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3442 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE,
3444 ASM_INPUT_P ($$) = 1; }
3445 /* This is the case with just output operands. */
3446 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3447 { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
3448 /* This is the case with input operands as well. */
3449 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3450 asm_operands ')' ';'
3451 { $$ = finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
3452 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ')' ';'
3453 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); }
3454 /* This is the case with clobbered registers as well. */
3455 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3456 asm_operands ':' asm_clobbers ')' ';'
3457 { $$ = finish_asm_stmt ($2, $4, $6, $8, $10); }
3458 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ':'
3459 asm_clobbers ')' ';'
3460 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); }
3461 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands SCOPE
3462 asm_clobbers ')' ';'
3463 { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
3467 pedwarn ("ISO C++ forbids computed gotos");
3468 $$ = finish_goto_stmt ($3);
3470 | GOTO identifier ';'
3471 { $$ = finish_goto_stmt ($2); }
3475 { error ("label must be followed by statement");
3485 | namespace_using_decl
3486 { do_local_using_decl ($1);
3494 { $<ttype>$ = begin_function_try_block (); }
3495 ctor_initializer_opt compstmt
3496 { finish_function_try_block ($<ttype>2); }
3499 finish_function_handler_sequence ($<ttype>2);
3506 { $<ttype>$ = begin_try_block (); }
3508 { finish_try_block ($<ttype>2); }
3510 { finish_handler_sequence ($<ttype>2); }
3515 | handler_seq handler
3520 { $<ttype>$ = begin_handler (); }
3522 { finish_handler_parms ($3, $<ttype>2); }
3524 { finish_handler ($<ttype>2); }
3528 typed_typespecs %prec EMPTY
3529 | nonempty_cv_qualifiers %prec EMPTY
3535 /* This doesn't allow reference parameters, the below does.
3536 | '(' type_specifier_seq absdcl ')'
3537 { check_for_new_type ("inside exception declarations", $2);
3538 expand_start_catch_block ($2.t, $3); }
3539 | '(' type_specifier_seq ')'
3540 { check_for_new_type ("inside exception declarations", $2);
3541 expand_start_catch_block ($2.t, NULL_TREE); }
3542 | '(' type_specifier_seq notype_declarator ')'
3543 { check_for_new_type ("inside exception declarations", $2);
3544 expand_start_catch_block ($2.t, $3); }
3545 | '(' typed_typespecs after_type_declarator ')'
3546 { check_for_new_type ("inside exception declarations", $2);
3547 expand_start_catch_block ($2.t, $3); }
3548 This allows reference parameters... */
3551 check_for_new_type ("inside exception declarations", $2);
3552 $$ = start_handler_parms (TREE_PURPOSE ($2.t),
3559 { finish_label_stmt ($1); }
3561 { finish_label_stmt ($1); }
3563 { finish_label_stmt ($1); }
3565 { finish_label_stmt ($1); }
3570 { finish_expr_stmt ($1); }
3574 pedwarn ("ISO C++ forbids compound statements inside for initializations");
3578 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3594 /* These are the operands other than the first string and colon
3595 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3599 | nonnull_asm_operands
3602 nonnull_asm_operands:
3604 | nonnull_asm_operands ',' asm_operand
3605 { $$ = chainon ($$, $3); }
3610 { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
3611 | '[' identifier ']' STRING '(' expr ')'
3612 { $$ = build_tree_list (build_tree_list ($2, $4), $6); }
3617 { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE);}
3618 | asm_clobbers ',' string
3619 { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
3622 /* This is what appears inside the parens in a function declarator.
3623 Its value is represented in the format that grokdeclarator expects.
3625 In C++, declaring a function with no parameters
3626 means that that function takes *no* parameters. */
3635 { $$ = finish_parmlist (build_tree_list (NULL_TREE, $1.t), 0);
3636 check_for_new_type ("inside parameter list", $1); }
3639 /* This nonterminal does not include the common sequence '(' type_id ')',
3640 as it is ambiguous and must be disambiguated elsewhere. */
3643 { $$ = finish_parmlist ($$, 0); }
3644 | parms_comma ELLIPSIS
3645 { $$ = finish_parmlist ($1, 1); }
3646 /* C++ allows an ellipsis without a separating ',' */
3648 { $$ = finish_parmlist ($1, 1); }
3650 { $$ = finish_parmlist (build_tree_list (NULL_TREE,
3653 { $$ = finish_parmlist (NULL_TREE, 1); }
3656 /* This helps us recover from really nasty
3657 parse errors, for example, a missing right
3659 yyerror ("possibly missing ')'");
3660 $$ = finish_parmlist ($1, 0);
3666 /* This helps us recover from really nasty
3667 parse errors, for example, a missing right
3669 yyerror ("possibly missing ')'");
3670 $$ = finish_parmlist (build_tree_list (NULL_TREE,
3677 /* A default argument to a */
3680 { maybe_snarf_defarg (); }
3690 /* A nonempty list of parameter declarations or type names. */
3693 { check_for_new_type ("in a parameter list", $1);
3694 $$ = build_tree_list (NULL_TREE, $1.t); }
3696 { check_for_new_type ("in a parameter list", $1);
3697 $$ = build_tree_list ($2, $1.t); }
3698 | parms_comma full_parm
3699 { check_for_new_type ("in a parameter list", $2);
3700 $$ = chainon ($$, $2.t); }
3701 | parms_comma bad_parm
3702 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
3703 | parms_comma bad_parm '=' init
3704 { $$ = chainon ($$, build_tree_list ($4, $2)); }
3710 { check_for_new_type ("in a parameter list", $1);
3711 $$ = build_tree_list (NULL_TREE, $1.t); }
3714 /* A single parameter declaration or parameter type name,
3715 as found in a parmlist. */
3717 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3718 TYPESPEC IDENTIFIER. */
3719 typed_declspecs1 declarator
3720 { tree specs = strip_attrs ($1.t);
3721 $$.new_type_flag = $1.new_type_flag;
3722 $$.t = build_tree_list (specs, $2); }
3723 | typed_typespecs declarator
3724 { $$.t = build_tree_list ($1.t, $2);
3725 $$.new_type_flag = $1.new_type_flag; }
3726 | typespec declarator
3727 { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
3729 $$.new_type_flag = $1.new_type_flag; }
3730 | typed_declspecs1 absdcl
3731 { tree specs = strip_attrs ($1.t);
3732 $$.t = build_tree_list (specs, $2);
3733 $$.new_type_flag = $1.new_type_flag; }
3734 | typed_declspecs1 %prec EMPTY
3735 { tree specs = strip_attrs ($1.t);
3736 $$.t = build_tree_list (specs, NULL_TREE);
3737 $$.new_type_flag = $1.new_type_flag; }
3738 | declmods notype_declarator
3739 { tree specs = strip_attrs ($1.t);
3740 $$.t = build_tree_list (specs, $2);
3741 $$.new_type_flag = 0; }
3746 { $$.t = build_tree_list (NULL_TREE, $1.t);
3747 $$.new_type_flag = $1.new_type_flag; }
3749 { $$.t = build_tree_list ($2, $1.t);
3750 $$.new_type_flag = $1.new_type_flag; }
3759 /* empty */ %prec EMPTY
3760 { see_typename (); }
3764 /* empty */ %prec EMPTY
3766 error ("type specifier omitted for parameter");
3767 $$ = build_tree_list (integer_type_node, NULL_TREE);
3771 error ("type specifier omitted for parameter");
3772 if (TREE_CODE ($$) == SCOPE_REF
3773 && (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM
3774 || TREE_CODE (TREE_OPERAND ($$, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM))
3775 cp_error (" perhaps you want `typename %E' to make it a type", $$);
3776 $$ = build_tree_list (integer_type_node, $$);
3781 IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore ';'
3783 cp_error("'%D' is used as a type, but is not defined as a type.", $1);
3784 $3 = error_mark_node;
3788 template_arg_list_ignore:
3789 '<' template_arg_list_opt template_close_bracket
3795 '(' nonnull_exprlist ')'
3800 exception_specification_opt:
3801 /* empty */ %prec EMPTY
3803 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
3805 | THROW LEFT_RIGHT %prec EMPTY
3806 { $$ = empty_except_spec; }
3809 ansi_raise_identifier:
3812 check_for_new_type ("exception specifier", $1);
3813 $$ = groktypename ($1.t);
3817 ansi_raise_identifiers:
3818 ansi_raise_identifier
3819 { $$ = add_exception_specifier (NULL_TREE, $1, 1); }
3820 | ansi_raise_identifiers ',' ansi_raise_identifier
3821 { $$ = add_exception_specifier ($1, $3, 1); }
3824 conversion_declarator:
3825 /* empty */ %prec EMPTY
3827 | '*' cv_qualifiers conversion_declarator
3828 { $$ = make_pointer_declarator ($2, $3); }
3829 | '&' cv_qualifiers conversion_declarator
3830 { $$ = make_reference_declarator ($2, $3); }
3831 | ptr_to_mem cv_qualifiers conversion_declarator
3832 { tree arg = make_pointer_declarator ($2, $3);
3833 $$ = build_nt (SCOPE_REF, $1, arg);
3840 saved_scopes = tree_cons (got_scope, got_object, saved_scopes);
3841 TREE_LANG_FLAG_0 (saved_scopes) = looking_for_typename;
3842 /* We look for conversion-type-id's in both the class and current
3843 scopes, just as for ID in 'ptr->ID::'. */
3844 looking_for_typename = 1;
3845 got_object = got_scope;
3846 got_scope = NULL_TREE;
3851 { got_scope = TREE_PURPOSE (saved_scopes);
3852 got_object = TREE_VALUE (saved_scopes);
3853 looking_for_typename = TREE_LANG_FLAG_0 (saved_scopes);
3854 saved_scopes = TREE_CHAIN (saved_scopes);
3859 operator '*' unoperator
3860 { $$ = frob_opname (ansi_opname (MULT_EXPR)); }
3861 | operator '/' unoperator
3862 { $$ = frob_opname (ansi_opname (TRUNC_DIV_EXPR)); }
3863 | operator '%' unoperator
3864 { $$ = frob_opname (ansi_opname (TRUNC_MOD_EXPR)); }
3865 | operator '+' unoperator
3866 { $$ = frob_opname (ansi_opname (PLUS_EXPR)); }
3867 | operator '-' unoperator
3868 { $$ = frob_opname (ansi_opname (MINUS_EXPR)); }
3869 | operator '&' unoperator
3870 { $$ = frob_opname (ansi_opname (BIT_AND_EXPR)); }
3871 | operator '|' unoperator
3872 { $$ = frob_opname (ansi_opname (BIT_IOR_EXPR)); }
3873 | operator '^' unoperator
3874 { $$ = frob_opname (ansi_opname (BIT_XOR_EXPR)); }
3875 | operator '~' unoperator
3876 { $$ = frob_opname (ansi_opname (BIT_NOT_EXPR)); }
3877 | operator ',' unoperator
3878 { $$ = frob_opname (ansi_opname (COMPOUND_EXPR)); }
3879 | operator ARITHCOMPARE unoperator
3880 { $$ = frob_opname (ansi_opname ($2)); }
3881 | operator '<' unoperator
3882 { $$ = frob_opname (ansi_opname (LT_EXPR)); }
3883 | operator '>' unoperator
3884 { $$ = frob_opname (ansi_opname (GT_EXPR)); }
3885 | operator EQCOMPARE unoperator
3886 { $$ = frob_opname (ansi_opname ($2)); }
3887 | operator ASSIGN unoperator
3888 { $$ = frob_opname (ansi_assopname ($2)); }
3889 | operator '=' unoperator
3890 { $$ = frob_opname (ansi_assopname (NOP_EXPR)); }
3891 | operator LSHIFT unoperator
3892 { $$ = frob_opname (ansi_opname ($2)); }
3893 | operator RSHIFT unoperator
3894 { $$ = frob_opname (ansi_opname ($2)); }
3895 | operator PLUSPLUS unoperator
3896 { $$ = frob_opname (ansi_opname (POSTINCREMENT_EXPR)); }
3897 | operator MINUSMINUS unoperator
3898 { $$ = frob_opname (ansi_opname (PREDECREMENT_EXPR)); }
3899 | operator ANDAND unoperator
3900 { $$ = frob_opname (ansi_opname (TRUTH_ANDIF_EXPR)); }
3901 | operator OROR unoperator
3902 { $$ = frob_opname (ansi_opname (TRUTH_ORIF_EXPR)); }
3903 | operator '!' unoperator
3904 { $$ = frob_opname (ansi_opname (TRUTH_NOT_EXPR)); }
3905 | operator '?' ':' unoperator
3906 { $$ = frob_opname (ansi_opname (COND_EXPR)); }
3907 | operator MIN_MAX unoperator
3908 { $$ = frob_opname (ansi_opname ($2)); }
3909 | operator POINTSAT unoperator %prec EMPTY
3910 { $$ = frob_opname (ansi_opname (COMPONENT_REF)); }
3911 | operator POINTSAT_STAR unoperator %prec EMPTY
3912 { $$ = frob_opname (ansi_opname (MEMBER_REF)); }
3913 | operator LEFT_RIGHT unoperator
3914 { $$ = frob_opname (ansi_opname (CALL_EXPR)); }
3915 | operator '[' ']' unoperator
3916 { $$ = frob_opname (ansi_opname (ARRAY_REF)); }
3917 | operator NEW unoperator %prec EMPTY
3918 { $$ = frob_opname (ansi_opname (NEW_EXPR)); }
3919 | operator DELETE unoperator %prec EMPTY
3920 { $$ = frob_opname (ansi_opname (DELETE_EXPR)); }
3921 | operator NEW '[' ']' unoperator
3922 { $$ = frob_opname (ansi_opname (VEC_NEW_EXPR)); }
3923 | operator DELETE '[' ']' unoperator
3924 { $$ = frob_opname (ansi_opname (VEC_DELETE_EXPR)); }
3925 | operator type_specifier_seq conversion_declarator unoperator
3926 { $$ = frob_opname (grokoptypename ($2.t, $3)); }
3927 | operator error unoperator
3928 { $$ = frob_opname (ansi_opname (ERROR_MARK)); }
3931 /* The forced readahead in here is because we might be at the end of a
3932 line, and lineno won't be bumped until yylex absorbs the first token
3933 on the next line. */
3935 { if (yychar == YYEMPTY)
3943 debug_yytranslate (value)
3946 return yytname[YYTRANSLATE (value)];