Allow compilation with GCC 4.4.
[official-gcc.git] / gcc / cp / parse.y
blob5c69c58e90facb47245fdeb630c798cf8be31ac9
1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002 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)
11 any later version.
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. */
32 #define YYDEBUG 1
34 #include "config.h"
36 #include "system.h"
38 #include "tree.h"
39 #include "input.h"
40 #include "flags.h"
41 #include "cp-tree.h"
42 #include "lex.h"
43 #include "output.h"
44 #include "except.h"
45 #include "toplev.h"
46 #include "ggc.h"
48 extern struct obstack permanent_obstack;
50 /* Like YYERROR but do call yyerror. */
51 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
53 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
54 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
56 /* Contains the statement keyword (if/while/do) to include in an
57 error message if the user supplies an empty conditional expression. */
58 static const char *cond_stmt_keyword;
60 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
61 int have_extern_spec;
62 int used_extern_spec;
64 /* List of types and structure classes of the current declaration. */
65 static tree current_declspecs;
67 /* List of prefix attributes in effect.
68 Prefix attributes are parsed by the reserved_declspecs and declmods
69 rules. They create a list that contains *both* declspecs and attrs. */
70 /* ??? It is not clear yet that all cases where an attribute can now appear in
71 a declspec list have been updated. */
72 static tree prefix_attributes;
74 /* When defining an enumeration, this is the type of the enumeration. */
75 static tree current_enum_type;
77 /* When parsing a conversion operator name, this is the scope of the
78 operator itself. */
79 static tree saved_scopes;
81 static tree empty_parms PARAMS ((void));
82 static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int));
83 static tree parse_decl PARAMS ((tree, tree, int));
84 static void parse_end_decl PARAMS ((tree, tree, tree));
85 static tree parse_field0 PARAMS ((tree, tree, tree, tree, tree, tree));
86 static tree parse_field PARAMS ((tree, tree, tree, tree));
87 static tree parse_bitfield0 PARAMS ((tree, tree, tree, tree, tree));
88 static tree parse_bitfield PARAMS ((tree, tree, tree));
89 static tree parse_method PARAMS ((tree, tree, tree));
90 static void frob_specs PARAMS ((tree, tree));
91 static void check_class_key PARAMS ((tree, tree));
93 /* Cons up an empty parameter list. */
94 static inline tree
95 empty_parms ()
97 tree parms;
99 #ifndef NO_IMPLICIT_EXTERN_C
100 if (in_system_header && current_class_type == NULL
101 && current_lang_name == lang_name_c)
102 parms = NULL_TREE;
103 else
104 #endif
105 parms = void_list_node;
106 return parms;
109 /* Record the decl-specifiers, attributes and type lookups from the
110 decl-specifier-seq in a declaration. */
112 static void
113 frob_specs (specs_attrs, lookups)
114 tree specs_attrs, lookups;
116 save_type_access_control (lookups);
117 split_specs_attrs (specs_attrs, &current_declspecs, &prefix_attributes);
118 if (current_declspecs
119 && TREE_CODE (current_declspecs) != TREE_LIST)
120 current_declspecs = build_tree_list (NULL_TREE, current_declspecs);
121 if (have_extern_spec && !used_extern_spec)
123 /* We have to indicate that there is an "extern", but that it
124 was part of a language specifier. For instance,
126 extern "C" typedef int (*Ptr) ();
128 is well formed. */
129 current_declspecs = tree_cons (error_mark_node,
130 get_identifier ("extern"),
131 current_declspecs);
132 used_extern_spec = 1;
136 static tree
137 parse_decl (declarator, attributes, initialized)
138 tree declarator, attributes;
139 int initialized;
141 return start_decl (declarator, current_declspecs, initialized,
142 attributes, prefix_attributes);
145 static tree
146 parse_decl0 (declarator, specs_attrs, lookups, attributes, initialized)
147 tree declarator, specs_attrs, lookups, attributes;
148 int initialized;
150 frob_specs (specs_attrs, lookups);
151 return parse_decl (declarator, attributes, initialized);
154 static void
155 parse_end_decl (decl, init, asmspec)
156 tree decl, init, asmspec;
158 /* If decl is NULL_TREE, then this was a variable declaration using
159 () syntax for the initializer, so we handled it in grokdeclarator. */
160 if (decl)
161 decl_type_access_control (decl);
162 cp_finish_decl (decl, init, asmspec, init ? LOOKUP_ONLYCONVERTING : 0);
165 static tree
166 parse_field (declarator, attributes, asmspec, init)
167 tree declarator, attributes, asmspec, init;
169 tree d = grokfield (declarator, current_declspecs, init, asmspec,
170 chainon (attributes, prefix_attributes));
171 decl_type_access_control (d);
172 return d;
175 static tree
176 parse_field0 (declarator, specs_attrs, lookups, attributes, asmspec, init)
177 tree declarator, specs_attrs, lookups, attributes, asmspec, init;
179 frob_specs (specs_attrs, lookups);
180 return parse_field (declarator, attributes, asmspec, init);
183 static tree
184 parse_bitfield (declarator, attributes, width)
185 tree declarator, attributes, width;
187 tree d = grokbitfield (declarator, current_declspecs, width);
188 cplus_decl_attributes (&d, chainon (attributes, prefix_attributes), 0);
189 decl_type_access_control (d);
190 return d;
193 static tree
194 parse_bitfield0 (declarator, specs_attrs, lookups, attributes, width)
195 tree declarator, specs_attrs, lookups, attributes, width;
197 frob_specs (specs_attrs, lookups);
198 return parse_bitfield (declarator, attributes, width);
201 static tree
202 parse_method (declarator, specs_attrs, lookups)
203 tree declarator, specs_attrs, lookups;
205 tree d;
206 frob_specs (specs_attrs, lookups);
207 d = start_method (current_declspecs, declarator, prefix_attributes);
208 decl_type_access_control (d);
209 return d;
212 static void
213 check_class_key (key, aggr)
214 tree key;
215 tree aggr;
217 if (TREE_CODE (key) == TREE_LIST)
218 key = TREE_VALUE (key);
219 if ((key == union_type_node) != (TREE_CODE (aggr) == UNION_TYPE))
220 pedwarn ("`%s' tag used in naming `%#T'",
221 key == union_type_node ? "union"
222 : key == record_type_node ? "struct" : "class", aggr);
225 void
226 cp_parse_init ()
228 ggc_add_tree_root (&current_declspecs, 1);
229 ggc_add_tree_root (&prefix_attributes, 1);
230 ggc_add_tree_root (&current_enum_type, 1);
231 ggc_add_tree_root (&saved_scopes, 1);
234 /* Rename the "yyparse" function so that we can override it elsewhere. */
235 #define yyparse yyparse_1
238 %start program
240 %union {
241 long itype;
242 tree ttype;
243 char *strtype;
244 enum tree_code code;
245 flagged_type_tree ftype;
246 struct unparsed_text *pi;
249 /* All identifiers that are not reserved words
250 and are not declared typedefs in the current block */
251 %token IDENTIFIER
253 /* All identifiers that are declared typedefs in the current block.
254 In some contexts, they are treated just like IDENTIFIER,
255 but they can also serve as typespecs in declarations. */
256 %token tTYPENAME
257 %token SELFNAME
259 /* A template function. */
260 %token PFUNCNAME
262 /* Reserved words that specify storage class.
263 yylval contains an IDENTIFIER_NODE which indicates which one. */
264 %token SCSPEC
266 /* Reserved words that specify type.
267 yylval contains an IDENTIFIER_NODE which indicates which one. */
268 %token TYPESPEC
270 /* Reserved words that qualify type: "const" or "volatile".
271 yylval contains an IDENTIFIER_NODE which indicates which one. */
272 %token CV_QUALIFIER
274 /* Character or numeric constants.
275 yylval is the node for the constant. */
276 %token CONSTANT
278 /* __func__, __FUNCTION__ or __PRETTY_FUNCTION__.
279 yylval contains an IDENTIFIER_NODE which indicates which one. */
280 %token VAR_FUNC_NAME
282 /* String constants in raw form.
283 yylval is a STRING_CST node. */
284 %token STRING
286 /* "...", used for functions with variable arglists. */
287 %token ELLIPSIS
289 /* the reserved words */
290 /* SCO include files test "ASM", so use something else. */
291 %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
292 %token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
293 %token SIGOF
294 %token ATTRIBUTE EXTENSION LABEL
295 %token REALPART IMAGPART VA_ARG
297 /* the reserved words... C++ extensions */
298 %token <ttype> AGGR
299 %token <ttype> VISSPEC
300 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
301 %token NAMESPACE TYPENAME_KEYWORD USING
302 %token LEFT_RIGHT TEMPLATE
303 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
304 %token SCOPE EXPORT
306 /* Define the operator tokens and their precedences.
307 The value is an integer because, if used, it is the tree code
308 to use in the expression made from the operator. */
310 %left EMPTY /* used to resolve s/r with epsilon */
312 %left error
314 /* Add precedence rules to solve dangling else s/r conflict */
315 %nonassoc IF
316 %nonassoc ELSE
318 %left IDENTIFIER PFUNCNAME tTYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD ATTRIBUTE
320 %left '{' ',' ';'
322 %nonassoc THROW
323 %right <code> ':'
324 %right <code> ASSIGN '='
325 %right <code> '?'
326 %left <code> OROR
327 %left <code> ANDAND
328 %left <code> '|'
329 %left <code> '^'
330 %left <code> '&'
331 %left <code> MIN_MAX
332 %left <code> EQCOMPARE
333 %left <code> ARITHCOMPARE '<' '>'
334 %left <code> LSHIFT RSHIFT
335 %left <code> '+' '-'
336 %left <code> '*' '/' '%'
337 %left <code> POINTSAT_STAR DOT_STAR
338 %right <code> UNARY PLUSPLUS MINUSMINUS '~'
339 %left HYPERUNARY
340 %left <ttype> LEFT_RIGHT
341 %left <code> POINTSAT '.' '(' '['
343 %right SCOPE /* C++ extension */
344 %nonassoc NEW DELETE TRY CATCH
346 %type <code> unop
348 %type <ttype> identifier IDENTIFIER tTYPENAME CONSTANT expr nonnull_exprlist
349 %type <ttype> PFUNCNAME maybe_identifier
350 %type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME
351 %type <ttype> expr_no_commas expr_no_comma_rangle
352 %type <ttype> cast_expr unary_expr primary string STRING
353 %type <ttype> reserved_declspecs boolean.literal
354 %type <ttype> reserved_typespecquals
355 %type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
356 %type <ttype> init initlist maybeasm maybe_init defarg defarg1
357 %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
358 %type <ttype> maybe_attribute attributes attribute attribute_list attrib
359 %type <ttype> any_word
361 %type <itype> save_lineno
362 %type <ttype> simple_stmt simple_if
364 %type <ttype> declarator notype_declarator after_type_declarator
365 %type <ttype> notype_declarator_intern absdcl_intern
366 %type <ttype> after_type_declarator_intern
367 %type <ttype> direct_notype_declarator direct_after_type_declarator
368 %type <itype> components notype_components
369 %type <ttype> component_decl component_decl_1
370 %type <ttype> component_declarator component_declarator0
371 %type <ttype> notype_component_declarator notype_component_declarator0
372 %type <ttype> after_type_component_declarator after_type_component_declarator0
373 %type <ttype> absdcl cv_qualifiers
374 %type <ttype> direct_abstract_declarator conversion_declarator
375 %type <ttype> new_declarator direct_new_declarator
376 %type <ttype> xexpr parmlist parms bad_parm
377 %type <ttype> identifiers_or_typenames
378 %type <ttype> fcast_or_absdcl regcast_or_absdcl
379 %type <ttype> expr_or_declarator expr_or_declarator_intern
380 %type <ttype> complex_notype_declarator
381 %type <ttype> notype_unqualified_id unqualified_id qualified_id
382 %type <ttype> template_id do_id object_template_id notype_template_declarator
383 %type <ttype> overqualified_id notype_qualified_id any_id
384 %type <ttype> complex_direct_notype_declarator functional_cast
385 %type <ttype> complex_parmlist parms_comma
386 %type <ttype> namespace_qualifier namespace_using_decl
388 %type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs
389 %type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
390 %type <ftype> structsp typespecqual_reserved parm named_parm full_parm
391 %type <ftype> declmods
393 %type <itype> extension
395 /* C++ extensions */
396 %token <ttype> PTYPENAME
397 %token <ttype> EXTERN_LANG_STRING ALL
398 %token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
399 %token <pi> PRE_PARSED_FUNCTION_DECL
400 %type <ttype> component_constructor_declarator
401 %type <ttype> fn.def2 return_id constructor_declarator
402 %type <ttype> .begin_function_body
403 %type <ttype> class_head class_head_apparent_template
404 %type <ftype> class_head_decl class_head_defn
405 %type <ttype> base_class_list
406 %type <ttype> base_class_access_list
407 %type <ttype> base_class maybe_base_class_list base_class.1
408 %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
409 %type <ttype> operator_name
410 %type <ttype> object aggr
411 %type <itype> new delete
412 /* %type <ttype> primary_no_id */
413 %type <ttype> maybe_parmlist
414 %type <ttype> member_init
415 %type <ftype> member_init_list
416 %type <ttype> template_parm_header template_spec_header template_header
417 %type <ttype> template_parm_list template_parm
418 %type <ttype> template_type_parm template_template_parm
419 %type <code> template_close_bracket
420 %type <ttype> apparent_template_type
421 %type <ttype> template_type template_arg_list template_arg_list_opt
422 %type <ttype> template_arg
423 %type <ttype> condition xcond paren_cond_or_null
424 %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
425 %type <ttype> complete_type_name notype_identifier nonnested_type
426 %type <ttype> complex_type_name nested_name_specifier_1
427 %type <ttype> new_initializer new_placement
428 %type <ttype> using_decl
429 %type <ttype> typename_sub typename_sub0 typename_sub1 typename_sub2
430 %type <ttype> explicit_template_type
431 /* in order to recognize aggr tags as defining and thus shadowing. */
432 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
433 %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
434 %type <ttype> handler_args
435 %type <ttype> self_template_type .finish_template_type
437 %token NSNAME
438 %type <ttype> NSNAME
440 /* Used in lex.c for parsing pragmas. */
441 %token END_OF_LINE
443 /* lex.c and pt.c depend on this being the last token. Define
444 any new tokens before this one! */
445 %token END_OF_SAVED_INPUT
448 /* Tell yyparse how to print a token's value, if yydebug is set. */
449 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
450 extern void yyprint PARAMS ((FILE *, int, YYSTYPE));
454 program:
455 /* empty */
456 { finish_translation_unit (); }
457 | extdefs
458 { finish_translation_unit (); }
461 /* the reason for the strange actions in this rule
462 is so that notype_initdecls when reached via datadef
463 can find a valid list of type and sc specs in $0. */
465 extdefs:
466 { $<ttype>$ = NULL_TREE; }
467 lang_extdef
468 { $<ttype>$ = NULL_TREE; ggc_collect (); }
469 | extdefs lang_extdef
470 { $<ttype>$ = NULL_TREE; ggc_collect (); }
473 extdefs_opt:
474 extdefs
475 | /* empty */
478 .hush_warning:
479 { have_extern_spec = 1;
480 used_extern_spec = 0;
481 $<ttype>$ = NULL_TREE; }
483 .warning_ok:
484 { have_extern_spec = 0; }
487 extension:
488 EXTENSION
489 { $$ = pedantic;
490 pedantic = 0; }
493 asm_keyword:
494 ASM_KEYWORD
497 lang_extdef:
498 { if (pending_lang_change) do_pending_lang_change();
499 type_lookups = NULL_TREE; }
500 extdef
501 { if (! toplevel_bindings_p ())
502 pop_everything (); }
505 extdef:
506 fndef eat_saved_input
507 { do_pending_inlines (); }
508 | datadef
509 { do_pending_inlines (); }
511 | EXPORT
512 { warning ("keyword `export' not implemented, and will be ignored"); }
513 template_def
514 { do_pending_inlines (); }
515 | template_def
516 { do_pending_inlines (); }
517 | asm_keyword '(' string ')' ';'
518 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
519 assemble_asm ($3); }
520 | extern_lang_string '{' extdefs_opt '}'
521 { pop_lang_context (); }
522 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
523 { do_pending_inlines (); pop_lang_context (); }
524 | extern_lang_string .hush_warning datadef .warning_ok
525 { do_pending_inlines (); pop_lang_context (); }
526 | NAMESPACE identifier '{'
527 { push_namespace ($2); }
528 extdefs_opt '}'
529 { pop_namespace (); }
530 | NAMESPACE '{'
531 { push_namespace (NULL_TREE); }
532 extdefs_opt '}'
533 { pop_namespace (); }
534 | namespace_alias
535 | using_decl ';'
536 { do_toplevel_using_decl ($1); }
537 | using_directive
538 | extension extdef
539 { pedantic = $1; }
542 namespace_alias:
543 NAMESPACE identifier '='
544 { begin_only_namespace_names (); }
545 any_id ';'
547 end_only_namespace_names ();
548 if (lastiddecl)
549 $5 = lastiddecl;
550 do_namespace_alias ($2, $5);
554 using_decl:
555 USING qualified_id
556 { $$ = $2; }
557 | USING global_scope qualified_id
558 { $$ = $3; }
559 | USING global_scope unqualified_id
560 { $$ = $3; }
563 namespace_using_decl:
564 USING namespace_qualifier identifier
565 { $$ = build_nt (SCOPE_REF, $2, $3); }
566 | USING global_scope identifier
567 { $$ = build_nt (SCOPE_REF, global_namespace, $3); }
568 | USING global_scope namespace_qualifier identifier
569 { $$ = build_nt (SCOPE_REF, $3, $4); }
572 using_directive:
573 USING NAMESPACE
574 { begin_only_namespace_names (); }
575 any_id ';'
577 end_only_namespace_names ();
578 /* If no declaration was found, the using-directive is
579 invalid. Since that was not reported, we need the
580 identifier for the error message. */
581 if (TREE_CODE ($4) == IDENTIFIER_NODE && lastiddecl)
582 $4 = lastiddecl;
583 do_using_directive ($4);
587 namespace_qualifier:
588 NSNAME SCOPE
590 if (TREE_CODE ($$) == IDENTIFIER_NODE)
591 $$ = lastiddecl;
592 got_scope = $$;
594 | namespace_qualifier NSNAME SCOPE
596 $$ = $2;
597 if (TREE_CODE ($$) == IDENTIFIER_NODE)
598 $$ = lastiddecl;
599 got_scope = $$;
603 any_id:
604 unqualified_id
605 | qualified_id
606 | global_scope qualified_id
607 { $$ = $2; }
608 | global_scope unqualified_id
609 { $$ = $2; }
612 extern_lang_string:
613 EXTERN_LANG_STRING
614 { push_lang_context ($1); }
615 | extern_lang_string EXTERN_LANG_STRING
616 { if (current_lang_name != $2)
617 error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
618 pop_lang_context (); push_lang_context ($2); }
621 template_parm_header:
622 TEMPLATE '<'
623 { begin_template_parm_list (); }
624 template_parm_list '>'
625 { $$ = end_template_parm_list ($4); }
628 template_spec_header:
629 TEMPLATE '<' '>'
630 { begin_specialization();
631 $$ = NULL_TREE; }
634 template_header:
635 template_parm_header
636 | template_spec_header
639 template_parm_list:
640 template_parm
641 { $$ = process_template_parm (NULL_TREE, $1); }
642 | template_parm_list ',' template_parm
643 { $$ = process_template_parm ($1, $3); }
646 maybe_identifier:
647 identifier
648 { $$ = $1; }
649 | /* empty */
650 { $$ = NULL_TREE; }
653 template_type_parm:
654 aggr maybe_identifier
655 { $$ = finish_template_type_parm ($1, $2); }
656 | TYPENAME_KEYWORD maybe_identifier
657 { $$ = finish_template_type_parm (class_type_node, $2); }
660 template_template_parm:
661 template_parm_header aggr maybe_identifier
662 { $$ = finish_template_template_parm ($2, $3); }
665 template_parm:
666 /* The following rules introduce a new reduce/reduce
667 conflict on the ',' and '>' input tokens: they are valid
668 prefixes for a `structsp', which means they could match a
669 nameless parameter. See 14.6, paragraph 3.
670 By putting them before the `parm' rule, we get
671 their match before considering them nameless parameter
672 declarations. */
673 template_type_parm
674 { $$ = build_tree_list (NULL_TREE, $1); }
675 | template_type_parm '=' type_id
676 { $$ = build_tree_list (groktypename ($3.t), $1); }
677 | parm
678 { $$ = build_tree_list (NULL_TREE, $1.t); }
679 | parm '=' expr_no_comma_rangle
680 { $$ = build_tree_list ($3, $1.t); }
681 | template_template_parm
682 { $$ = build_tree_list (NULL_TREE, $1); }
683 | template_template_parm '=' template_arg
685 if (TREE_CODE ($3) != TEMPLATE_DECL
686 && TREE_CODE ($3) != TEMPLATE_TEMPLATE_PARM
687 && TREE_CODE ($3) != TYPE_DECL
688 && TREE_CODE ($3) != UNBOUND_CLASS_TEMPLATE)
690 error ("invalid default template argument");
691 $3 = error_mark_node;
693 $$ = build_tree_list ($3, $1);
697 template_def:
698 template_header template_extdef
699 { finish_template_decl ($1); }
700 | template_header error %prec EMPTY
701 { finish_template_decl ($1); }
704 template_extdef:
705 fndef eat_saved_input
706 { do_pending_inlines (); }
707 | template_datadef
708 { do_pending_inlines (); }
709 | template_def
710 { do_pending_inlines (); }
711 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
712 { do_pending_inlines ();
713 pop_lang_context (); }
714 | extern_lang_string .hush_warning template_datadef .warning_ok
715 { do_pending_inlines ();
716 pop_lang_context (); }
717 | extension template_extdef
718 { pedantic = $1; }
721 template_datadef:
722 nomods_initdecls ';'
723 | declmods notype_initdecls ';'
725 | typed_declspecs initdecls ';'
726 { note_list_got_semicolon ($1.t); }
727 | structsp ';'
729 if ($1.t != error_mark_node)
731 maybe_process_partial_specialization ($1.t);
732 note_got_semicolon ($1.t);
737 datadef:
738 nomods_initdecls ';'
739 | declmods notype_initdecls ';'
741 | typed_declspecs initdecls ';'
742 { note_list_got_semicolon ($1.t); }
743 | declmods ';'
744 { pedwarn ("empty declaration"); }
745 | explicit_instantiation ';'
746 | typed_declspecs ';'
748 tree t, attrs;
749 split_specs_attrs ($1.t, &t, &attrs);
750 shadow_tag (t);
751 note_list_got_semicolon ($1.t);
753 | error ';'
754 | error '}'
755 | error END_OF_SAVED_INPUT
756 { end_input (); }
757 | ';'
758 | bad_decl
761 ctor_initializer_opt:
762 nodecls
763 | base_init
766 maybe_return_init:
767 /* empty */
768 | return_init
769 | return_init ';'
772 eat_saved_input:
773 /* empty */
774 | END_OF_SAVED_INPUT
777 /* The outermost block of a function really begins before the
778 mem-initializer-list, so we open one there and suppress the one that
779 actually corresponds to the curly braces. */
780 function_body:
781 .begin_function_body ctor_initializer_opt save_lineno '{'
782 { $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); }
783 compstmtend
785 STMT_LINENO ($<ttype>5) = $3;
786 finish_compound_stmt (/*has_no_scope=*/1, $<ttype>5);
787 finish_function_body ($1);
791 fndef:
792 fn.def1 maybe_return_init function_body
793 { expand_body (finish_function (0)); }
794 | fn.def1 maybe_return_init function_try_block
795 { expand_body (finish_function (0)); }
796 | fn.def1 maybe_return_init error
800 constructor_declarator:
801 nested_name_specifier SELFNAME '('
802 { $<ttype>$ = begin_constructor_declarator ($1, $2); }
803 parmlist ')' cv_qualifiers exception_specification_opt
804 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
805 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
806 { $$ = begin_constructor_declarator ($1, $2);
807 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
809 | global_scope nested_name_specifier SELFNAME '('
810 { $<ttype>$ = begin_constructor_declarator ($2, $3); }
811 parmlist ')' cv_qualifiers exception_specification_opt
812 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
813 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
814 { $$ = begin_constructor_declarator ($2, $3);
815 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
817 | nested_name_specifier self_template_type '('
818 { $<ttype>$ = begin_constructor_declarator ($1, $2); }
819 parmlist ')' cv_qualifiers exception_specification_opt
820 { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); }
821 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
822 { $$ = begin_constructor_declarator ($1, $2);
823 $$ = make_call_declarator ($$, empty_parms (), $4, $5);
825 | global_scope nested_name_specifier self_template_type '('
826 { $<ttype>$ = begin_constructor_declarator ($2, $3); }
827 parmlist ')' cv_qualifiers exception_specification_opt
828 { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); }
829 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
830 { $$ = begin_constructor_declarator ($2, $3);
831 $$ = make_call_declarator ($$, empty_parms (), $5, $6);
835 fn.def1:
836 typed_declspecs declarator
837 { check_for_new_type ("return type", $1);
838 if (!begin_function_definition ($1.t, $2))
839 YYERROR1; }
840 | declmods notype_declarator
841 { if (!begin_function_definition ($1.t, $2))
842 YYERROR1; }
843 | notype_declarator
844 { if (!begin_function_definition (NULL_TREE, $1))
845 YYERROR1; }
846 | declmods constructor_declarator
847 { if (!begin_function_definition ($1.t, $2))
848 YYERROR1; }
849 | constructor_declarator
850 { if (!begin_function_definition (NULL_TREE, $1))
851 YYERROR1; }
854 /* ANSI allows optional parentheses around constructor class names.
855 See ISO/IEC 14882:1998(E) 12.1. */
857 component_constructor_declarator:
858 SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt
859 { $$ = make_call_declarator ($1, $3, $5, $6); }
860 | '(' SELFNAME ')' '(' parmlist ')' cv_qualifiers
861 exception_specification_opt
862 { $$ = make_call_declarator ($2, $5, $7, $8); }
863 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
864 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
865 | '(' SELFNAME ')' LEFT_RIGHT cv_qualifiers exception_specification_opt
866 { $$ = make_call_declarator ($2, empty_parms (), $5, $6); }
867 | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt
868 { $$ = make_call_declarator ($1, $3, $5, $6); }
869 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
870 { $$ = make_call_declarator ($1, empty_parms (), $3, $4); }
873 /* more C++ complexity. See component_decl for a comment on the
874 reduce/reduce conflict introduced by these rules. */
875 fn.def2:
876 declmods component_constructor_declarator
877 { $$ = parse_method ($2, $1.t, $1.lookups);
878 rest_of_mdef:
879 if (! $$)
880 YYERROR1;
881 if (yychar == YYEMPTY)
882 yychar = YYLEX;
883 snarf_method ($$); }
884 | component_constructor_declarator
885 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
886 goto rest_of_mdef; }
887 | typed_declspecs declarator
888 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
889 | declmods notype_declarator
890 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
891 | notype_declarator
892 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
893 goto rest_of_mdef; }
894 | declmods constructor_declarator
895 { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;}
896 | constructor_declarator
897 { $$ = parse_method ($1, NULL_TREE, NULL_TREE);
898 goto rest_of_mdef; }
901 return_id:
902 RETURN_KEYWORD IDENTIFIER
904 $$ = $2;
908 return_init:
909 return_id maybe_init
910 { finish_named_return_value ($<ttype>$, $2); }
911 | return_id '(' nonnull_exprlist ')'
912 { finish_named_return_value ($<ttype>$, $3); }
913 | return_id LEFT_RIGHT
914 { finish_named_return_value ($<ttype>$, NULL_TREE); }
917 base_init:
918 ':' member_init_list
920 if (! DECL_CONSTRUCTOR_P (current_function_decl))
921 error ("only constructors take base initializers");
922 else if ($2.new_type_flag == 0)
923 error ("no base or member initializers given following ':'");
925 finish_mem_initializers ($2.t);
929 .begin_function_body:
930 /* empty */
932 $$ = begin_function_body ();
936 member_init_list:
937 /* empty */
939 $$.new_type_flag = 0;
940 $$.t = NULL_TREE;
942 | member_init
944 $$.new_type_flag = 1;
945 $$.t = $1;
947 | member_init_list ',' member_init
949 if ($3)
951 $$.new_type_flag = 1;
952 TREE_CHAIN ($3) = $1.t;
953 $$.t = $3;
955 else
956 $$ = $1;
958 | member_init_list error
961 member_init:
962 '(' nonnull_exprlist ')'
964 if (current_class_name)
965 pedwarn ("anachronistic old style base class initializer");
966 $$ = expand_member_init (current_class_ref, NULL_TREE, $2);
968 | LEFT_RIGHT
970 if (current_class_name)
971 pedwarn ("anachronistic old style base class initializer");
972 $$ = expand_member_init (current_class_ref,
973 NULL_TREE,
974 void_type_node);
976 | notype_identifier '(' nonnull_exprlist ')'
977 { $$ = expand_member_init (current_class_ref, $1, $3); }
978 | notype_identifier LEFT_RIGHT
979 { $$ = expand_member_init (current_class_ref, $1,
980 void_type_node); }
981 | nonnested_type '(' nonnull_exprlist ')'
982 { $$ = expand_member_init (current_class_ref, $1, $3); }
983 | nonnested_type LEFT_RIGHT
984 { $$ = expand_member_init (current_class_ref, $1,
985 void_type_node); }
986 | typename_sub '(' nonnull_exprlist ')'
987 { $$ = expand_member_init (current_class_ref, $1, $3); }
988 | typename_sub LEFT_RIGHT
989 { $$ = expand_member_init (current_class_ref, $1,
990 void_type_node); }
991 | error
992 { $$ = NULL_TREE; }
995 identifier:
996 IDENTIFIER
997 | tTYPENAME
998 | SELFNAME
999 | PTYPENAME
1000 | NSNAME
1003 notype_identifier:
1004 IDENTIFIER
1005 | PTYPENAME
1006 | NSNAME %prec EMPTY
1009 identifier_defn:
1010 IDENTIFIER_DEFN
1011 | TYPENAME_DEFN
1012 | PTYPENAME_DEFN
1015 explicit_instantiation:
1016 TEMPLATE begin_explicit_instantiation typespec ';'
1017 { do_type_instantiation ($3.t, NULL_TREE, 1);
1018 yyungetc (';', 1); }
1019 end_explicit_instantiation
1020 | TEMPLATE begin_explicit_instantiation typed_declspecs declarator
1021 { tree specs = strip_attrs ($3.t);
1022 do_decl_instantiation (specs, $4, NULL_TREE); }
1023 end_explicit_instantiation
1024 | TEMPLATE begin_explicit_instantiation notype_declarator
1025 { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); }
1026 end_explicit_instantiation
1027 | TEMPLATE begin_explicit_instantiation constructor_declarator
1028 { do_decl_instantiation (NULL_TREE, $3, NULL_TREE); }
1029 end_explicit_instantiation
1030 | SCSPEC TEMPLATE begin_explicit_instantiation typespec ';'
1031 { do_type_instantiation ($4.t, $1, 1);
1032 yyungetc (';', 1); }
1033 end_explicit_instantiation
1035 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
1036 declarator
1037 { tree specs = strip_attrs ($4.t);
1038 do_decl_instantiation (specs, $5, $1); }
1039 end_explicit_instantiation
1041 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
1042 { do_decl_instantiation (NULL_TREE, $4, $1); }
1043 end_explicit_instantiation
1045 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
1046 { do_decl_instantiation (NULL_TREE, $4, $1); }
1047 end_explicit_instantiation
1051 begin_explicit_instantiation:
1052 { begin_explicit_instantiation(); }
1055 end_explicit_instantiation:
1056 { end_explicit_instantiation(); }
1059 /* The TYPENAME expansions are to deal with use of a template class name as
1060 a template within the class itself, where the template decl is hidden by
1061 a type decl. Got all that? */
1063 template_type:
1064 PTYPENAME '<' template_arg_list_opt template_close_bracket
1065 .finish_template_type
1066 { $$ = $5; }
1067 | tTYPENAME '<' template_arg_list_opt template_close_bracket
1068 .finish_template_type
1069 { $$ = $5; }
1070 | self_template_type
1073 apparent_template_type:
1074 template_type
1075 | identifier '<' template_arg_list_opt '>'
1076 .finish_template_type
1077 { $$ = $5; }
1080 self_template_type:
1081 SELFNAME '<' template_arg_list_opt template_close_bracket
1082 .finish_template_type
1083 { $$ = $5; }
1086 .finish_template_type:
1088 if (yychar == YYEMPTY)
1089 yychar = YYLEX;
1091 $$ = finish_template_type ($<ttype>-3, $<ttype>-1,
1092 yychar == SCOPE);
1096 template_close_bracket:
1098 | RSHIFT
1100 /* Handle `Class<Class<Type>>' without space in the `>>' */
1101 pedwarn ("`>>' should be `> >' in template class name");
1102 yyungetc ('>', 1);
1106 template_arg_list_opt:
1107 /* empty */
1108 { $$ = NULL_TREE; }
1109 | template_arg_list
1112 template_arg_list:
1113 template_arg
1114 { $$ = build_tree_list (NULL_TREE, $$); }
1115 | template_arg_list ',' template_arg
1116 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
1119 template_arg:
1120 type_id
1121 { $$ = groktypename ($1.t); }
1122 | PTYPENAME
1124 $$ = lastiddecl;
1125 if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
1126 $$ = TREE_TYPE ($$);
1128 | global_scope PTYPENAME
1130 $$ = lastiddecl;
1131 if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
1132 $$ = TREE_TYPE ($$);
1134 | expr_no_comma_rangle
1135 | nested_name_specifier TEMPLATE identifier
1137 if (!processing_template_decl)
1139 error ("use of template qualifier outside template");
1140 $$ = error_mark_node;
1142 else
1143 $$ = make_unbound_class_template ($1, $3, 1);
1147 unop:
1149 { $$ = NEGATE_EXPR; }
1150 | '+'
1151 { $$ = CONVERT_EXPR; }
1152 | PLUSPLUS
1153 { $$ = PREINCREMENT_EXPR; }
1154 | MINUSMINUS
1155 { $$ = PREDECREMENT_EXPR; }
1156 | '!'
1157 { $$ = TRUTH_NOT_EXPR; }
1160 expr:
1161 nontrivial_exprlist
1162 { $$ = build_x_compound_expr ($$); }
1163 | expr_no_commas
1166 paren_expr_or_null:
1167 LEFT_RIGHT
1168 { error ("ISO C++ forbids an empty condition for `%s'",
1169 cond_stmt_keyword);
1170 $$ = integer_zero_node; }
1171 | '(' expr ')'
1172 { $$ = $2; }
1175 paren_cond_or_null:
1176 LEFT_RIGHT
1177 { error ("ISO C++ forbids an empty condition for `%s'",
1178 cond_stmt_keyword);
1179 $$ = integer_zero_node; }
1180 | '(' condition ')'
1181 { $$ = $2; }
1184 xcond:
1185 /* empty */
1186 { $$ = NULL_TREE; }
1187 | condition
1188 | error
1189 { $$ = NULL_TREE; }
1192 condition:
1193 type_specifier_seq declarator maybeasm maybe_attribute '='
1195 tree d;
1196 for (d = getdecls (); d; d = TREE_CHAIN (d))
1197 if (TREE_CODE (d) == TYPE_DECL) {
1198 tree s = TREE_TYPE (d);
1199 if (TREE_CODE (s) == RECORD_TYPE)
1200 error ("definition of class `%T' in condition", s);
1201 else if (TREE_CODE (s) == ENUMERAL_TYPE)
1202 error ("definition of enum `%T' in condition", s);
1205 current_declspecs = $1.t;
1206 $<ttype>$ = parse_decl ($<ttype>2, $4, 1);
1208 init
1210 parse_end_decl ($<ttype>6, $7, $4);
1211 $$ = convert_from_reference ($<ttype>6);
1212 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
1213 error ("definition of array `%#D' in condition", $$);
1215 | expr
1218 compstmtend:
1220 | maybe_label_decls stmts '}'
1221 | maybe_label_decls stmts error '}'
1222 | maybe_label_decls error '}'
1225 nontrivial_exprlist:
1226 expr_no_commas ',' expr_no_commas
1227 { $$ = tree_cons (NULL_TREE, $$,
1228 build_tree_list (NULL_TREE, $3)); }
1229 | expr_no_commas ',' error
1230 { $$ = tree_cons (NULL_TREE, $$,
1231 build_tree_list (NULL_TREE, error_mark_node)); }
1232 | nontrivial_exprlist ',' expr_no_commas
1233 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1234 | nontrivial_exprlist ',' error
1235 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1238 nonnull_exprlist:
1239 expr_no_commas
1240 { $$ = build_tree_list (NULL_TREE, $$); }
1241 | nontrivial_exprlist
1244 unary_expr:
1245 primary %prec UNARY
1246 { $$ = $1; }
1247 /* __extension__ turns off -pedantic for following primary. */
1248 | extension cast_expr %prec UNARY
1249 { $$ = $2;
1250 pedantic = $1; }
1251 | '*' cast_expr %prec UNARY
1252 { $$ = build_x_indirect_ref ($2, "unary *"); }
1253 | '&' cast_expr %prec UNARY
1254 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1255 | '~' cast_expr
1256 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1257 | unop cast_expr %prec UNARY
1258 { $$ = finish_unary_op_expr ($1, $2); }
1259 /* Refer to the address of a label as a pointer. */
1260 | ANDAND identifier
1261 { $$ = finish_label_address_expr ($2); }
1262 | sizeof unary_expr %prec UNARY
1263 { $$ = finish_sizeof ($2);
1264 skip_evaluation--; }
1265 | sizeof '(' type_id ')' %prec HYPERUNARY
1266 { $$ = finish_sizeof (groktypename ($3.t));
1267 check_for_new_type ("sizeof", $3);
1268 skip_evaluation--; }
1269 | alignof unary_expr %prec UNARY
1270 { $$ = finish_alignof ($2);
1271 skip_evaluation--; }
1272 | alignof '(' type_id ')' %prec HYPERUNARY
1273 { $$ = finish_alignof (groktypename ($3.t));
1274 check_for_new_type ("alignof", $3);
1275 skip_evaluation--; }
1277 /* The %prec EMPTY's here are required by the = init initializer
1278 syntax extension; see below. */
1279 | new new_type_id %prec EMPTY
1280 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1281 check_for_new_type ("new", $2); }
1282 | new new_type_id new_initializer
1283 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1284 check_for_new_type ("new", $2); }
1285 | new new_placement new_type_id %prec EMPTY
1286 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1287 check_for_new_type ("new", $3); }
1288 | new new_placement new_type_id new_initializer
1289 { $$ = build_new ($2, $3.t, $4, $1);
1290 check_for_new_type ("new", $3); }
1291 | new '(' type_id ')'
1292 %prec EMPTY
1293 { $$ = build_new (NULL_TREE, groktypename($3.t),
1294 NULL_TREE, $1);
1295 check_for_new_type ("new", $3); }
1296 | new '(' type_id ')' new_initializer
1297 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1298 check_for_new_type ("new", $3); }
1299 | new new_placement '(' type_id ')' %prec EMPTY
1300 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1301 check_for_new_type ("new", $4); }
1302 | new new_placement '(' type_id ')' new_initializer
1303 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1304 check_for_new_type ("new", $4); }
1306 | delete cast_expr %prec UNARY
1307 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1308 | delete '[' ']' cast_expr %prec UNARY
1309 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1310 if (yychar == YYEMPTY)
1311 yychar = YYLEX; }
1312 | delete '[' expr ']' cast_expr %prec UNARY
1313 { $$ = delete_sanity ($5, $3, 2, $1);
1314 if (yychar == YYEMPTY)
1315 yychar = YYLEX; }
1316 | REALPART cast_expr %prec UNARY
1317 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1318 | IMAGPART cast_expr %prec UNARY
1319 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1322 new_placement:
1323 '(' nonnull_exprlist ')'
1324 { $$ = $2; }
1325 | '{' nonnull_exprlist '}'
1326 { pedwarn ("old style placement syntax, use () instead");
1327 $$ = $2; }
1330 new_initializer:
1331 '(' nonnull_exprlist ')'
1332 { $$ = $2; }
1333 | LEFT_RIGHT
1334 { $$ = void_zero_node; }
1335 | '(' typespec ')'
1337 error ("`%T' is not a valid expression", $2.t);
1338 $$ = error_mark_node;
1340 /* GNU extension so people can use initializer lists. Note that
1341 this alters the meaning of `new int = 1', which was previously
1342 syntactically valid but semantically invalid.
1343 This feature is now deprecated and will be removed in a future
1344 release. */
1345 | '=' init
1347 if (pedantic)
1348 pedwarn ("ISO C++ forbids initialization of new expression with `='");
1349 cp_deprecated ("new initializer lists extension");
1350 if (TREE_CODE ($2) != TREE_LIST
1351 && TREE_CODE ($2) != CONSTRUCTOR)
1352 $$ = build_tree_list (NULL_TREE, $2);
1353 else
1354 $$ = $2;
1358 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1359 regcast_or_absdcl:
1360 '(' type_id ')' %prec EMPTY
1361 { $2.t = finish_parmlist (build_tree_list (NULL_TREE, $2.t), 0);
1362 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1363 check_for_new_type ("cast", $2); }
1364 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1365 { $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0);
1366 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1367 check_for_new_type ("cast", $3); }
1370 cast_expr:
1371 unary_expr
1372 | regcast_or_absdcl unary_expr %prec UNARY
1373 { $$ = reparse_absdcl_as_casts ($$, $2); }
1374 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1376 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1377 nreverse ($3));
1378 if (pedantic)
1379 pedwarn ("ISO C++ forbids compound literals");
1380 /* Indicate that this was a C99 compound literal. */
1381 TREE_HAS_CONSTRUCTOR (init) = 1;
1383 $$ = reparse_absdcl_as_casts ($$, init);
1387 expr_no_commas:
1388 cast_expr
1389 /* Handle general members. */
1390 | expr_no_commas POINTSAT_STAR expr_no_commas
1391 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1392 | expr_no_commas DOT_STAR expr_no_commas
1393 { $$ = build_m_component_ref ($$, $3); }
1394 | expr_no_commas '+' expr_no_commas
1395 { $$ = build_x_binary_op ($2, $$, $3); }
1396 | expr_no_commas '-' expr_no_commas
1397 { $$ = build_x_binary_op ($2, $$, $3); }
1398 | expr_no_commas '*' expr_no_commas
1399 { $$ = build_x_binary_op ($2, $$, $3); }
1400 | expr_no_commas '/' expr_no_commas
1401 { $$ = build_x_binary_op ($2, $$, $3); }
1402 | expr_no_commas '%' expr_no_commas
1403 { $$ = build_x_binary_op ($2, $$, $3); }
1404 | expr_no_commas LSHIFT expr_no_commas
1405 { $$ = build_x_binary_op ($2, $$, $3); }
1406 | expr_no_commas RSHIFT expr_no_commas
1407 { $$ = build_x_binary_op ($2, $$, $3); }
1408 | expr_no_commas ARITHCOMPARE expr_no_commas
1409 { $$ = build_x_binary_op ($2, $$, $3); }
1410 | expr_no_commas '<' expr_no_commas
1411 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1412 | expr_no_commas '>' expr_no_commas
1413 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1414 | expr_no_commas EQCOMPARE expr_no_commas
1415 { $$ = build_x_binary_op ($2, $$, $3); }
1416 | expr_no_commas MIN_MAX expr_no_commas
1417 { $$ = build_x_binary_op ($2, $$, $3); }
1418 | expr_no_commas '&' expr_no_commas
1419 { $$ = build_x_binary_op ($2, $$, $3); }
1420 | expr_no_commas '|' expr_no_commas
1421 { $$ = build_x_binary_op ($2, $$, $3); }
1422 | expr_no_commas '^' expr_no_commas
1423 { $$ = build_x_binary_op ($2, $$, $3); }
1424 | expr_no_commas ANDAND expr_no_commas
1425 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1426 | expr_no_commas OROR expr_no_commas
1427 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1428 | expr_no_commas '?' xexpr ':' expr_no_commas
1429 { $$ = build_x_conditional_expr ($$, $3, $5); }
1430 | expr_no_commas '=' expr_no_commas
1431 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1432 if ($$ != error_mark_node)
1433 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1434 | expr_no_commas ASSIGN expr_no_commas
1435 { $$ = build_x_modify_expr ($$, $2, $3); }
1436 | THROW
1437 { $$ = build_throw (NULL_TREE); }
1438 | THROW expr_no_commas
1439 { $$ = build_throw ($2); }
1442 expr_no_comma_rangle:
1443 cast_expr
1444 /* Handle general members. */
1445 | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
1446 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1447 | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
1448 { $$ = build_m_component_ref ($$, $3); }
1449 | expr_no_comma_rangle '+' expr_no_comma_rangle
1450 { $$ = build_x_binary_op ($2, $$, $3); }
1451 | expr_no_comma_rangle '-' expr_no_comma_rangle
1452 { $$ = build_x_binary_op ($2, $$, $3); }
1453 | expr_no_comma_rangle '*' expr_no_comma_rangle
1454 { $$ = build_x_binary_op ($2, $$, $3); }
1455 | expr_no_comma_rangle '/' expr_no_comma_rangle
1456 { $$ = build_x_binary_op ($2, $$, $3); }
1457 | expr_no_comma_rangle '%' expr_no_comma_rangle
1458 { $$ = build_x_binary_op ($2, $$, $3); }
1459 | expr_no_comma_rangle LSHIFT expr_no_comma_rangle
1460 { $$ = build_x_binary_op ($2, $$, $3); }
1461 | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
1462 { $$ = build_x_binary_op ($2, $$, $3); }
1463 | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
1464 { $$ = build_x_binary_op ($2, $$, $3); }
1465 | expr_no_comma_rangle '<' expr_no_comma_rangle
1466 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1467 | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
1468 { $$ = build_x_binary_op ($2, $$, $3); }
1469 | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
1470 { $$ = build_x_binary_op ($2, $$, $3); }
1471 | expr_no_comma_rangle '&' expr_no_comma_rangle
1472 { $$ = build_x_binary_op ($2, $$, $3); }
1473 | expr_no_comma_rangle '|' expr_no_comma_rangle
1474 { $$ = build_x_binary_op ($2, $$, $3); }
1475 | expr_no_comma_rangle '^' expr_no_comma_rangle
1476 { $$ = build_x_binary_op ($2, $$, $3); }
1477 | expr_no_comma_rangle ANDAND expr_no_comma_rangle
1478 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1479 | expr_no_comma_rangle OROR expr_no_comma_rangle
1480 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1481 | expr_no_comma_rangle '?' xexpr ':' expr_no_comma_rangle
1482 { $$ = build_x_conditional_expr ($$, $3, $5); }
1483 | expr_no_comma_rangle '=' expr_no_comma_rangle
1484 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1485 if ($$ != error_mark_node)
1486 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1487 | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
1488 { $$ = build_x_modify_expr ($$, $2, $3); }
1489 | THROW
1490 { $$ = build_throw (NULL_TREE); }
1491 | THROW expr_no_comma_rangle
1492 { $$ = build_throw ($2); }
1495 notype_unqualified_id:
1496 '~' see_typename identifier
1497 { $$ = build_nt (BIT_NOT_EXPR, $3); }
1498 | '~' see_typename template_type
1499 { $$ = build_nt (BIT_NOT_EXPR, $3); }
1500 | template_id
1501 | operator_name
1502 | IDENTIFIER
1503 | PTYPENAME
1504 | NSNAME %prec EMPTY
1507 do_id:
1509 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1510 means that we're in an expression like S::f<int>, so
1511 don't do_identifier; we only do that for unqualified
1512 identifiers. */
1513 if (!lastiddecl || TREE_CODE (lastiddecl) != TREE_LIST)
1514 $$ = do_identifier ($<ttype>-1, 3, NULL_TREE);
1515 else
1516 $$ = $<ttype>-1;
1520 template_id:
1521 PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket
1522 { $$ = lookup_template_function ($3, $4); }
1523 | operator_name '<' do_id template_arg_list_opt template_close_bracket
1524 { $$ = lookup_template_function ($3, $4); }
1527 object_template_id:
1528 TEMPLATE identifier '<' template_arg_list_opt template_close_bracket
1529 { $$ = lookup_template_function ($2, $4); }
1530 | TEMPLATE PFUNCNAME '<' template_arg_list_opt template_close_bracket
1531 { $$ = lookup_template_function ($2, $4); }
1532 | TEMPLATE operator_name '<' template_arg_list_opt
1533 template_close_bracket
1534 { $$ = lookup_template_function ($2, $4); }
1537 unqualified_id:
1538 notype_unqualified_id
1539 | tTYPENAME
1540 | SELFNAME
1543 expr_or_declarator_intern:
1544 expr_or_declarator
1545 | attributes expr_or_declarator
1547 /* Provide support for '(' attributes '*' declarator ')'
1548 etc */
1549 $$ = tree_cons ($1, $2, NULL_TREE);
1553 expr_or_declarator:
1554 notype_unqualified_id
1555 | '*' expr_or_declarator_intern %prec UNARY
1556 { $$ = build_nt (INDIRECT_REF, $2); }
1557 | '&' expr_or_declarator_intern %prec UNARY
1558 { $$ = build_nt (ADDR_EXPR, $2); }
1559 | '(' expr_or_declarator_intern ')'
1560 { $$ = $2; }
1563 notype_template_declarator:
1564 IDENTIFIER '<' template_arg_list_opt template_close_bracket
1565 { $$ = lookup_template_function ($1, $3); }
1566 | NSNAME '<' template_arg_list template_close_bracket
1567 { $$ = lookup_template_function ($1, $3); }
1570 direct_notype_declarator:
1571 complex_direct_notype_declarator
1572 /* This precedence declaration is to prefer this reduce
1573 to the Koenig lookup shift in primary, below. I hate yacc. */
1574 | notype_unqualified_id %prec '('
1575 | notype_template_declarator
1576 | '(' expr_or_declarator_intern ')'
1577 { $$ = finish_decl_parsing ($2); }
1580 primary:
1581 notype_unqualified_id
1583 if (TREE_CODE ($1) == BIT_NOT_EXPR)
1584 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($1, 0));
1585 else
1586 $$ = finish_id_expr ($1);
1588 | CONSTANT
1589 | boolean.literal
1590 | string
1592 $$ = combine_strings ($$);
1593 /* combine_strings doesn't set up TYPE_MAIN_VARIANT of
1594 a const array the way we want, so fix it. */
1595 if (flag_const_strings)
1596 TREE_TYPE ($$) = build_cplus_array_type
1597 (TREE_TYPE (TREE_TYPE ($$)),
1598 TYPE_DOMAIN (TREE_TYPE ($$)));
1600 | VAR_FUNC_NAME
1602 $$ = fname_decl (C_RID_CODE ($$), $$);
1603 if (processing_template_decl)
1604 $$ = build_min_nt (LOOKUP_EXPR, DECL_NAME ($$));
1606 | '(' expr ')'
1607 { $$ = finish_parenthesized_expr ($2); }
1608 | '(' expr_or_declarator_intern ')'
1609 { $2 = reparse_decl_as_expr (NULL_TREE, $2);
1610 $$ = finish_parenthesized_expr ($2); }
1611 | '(' error ')'
1612 { $$ = error_mark_node; }
1613 | '('
1614 { tree scope = current_scope ();
1615 if (!scope || TREE_CODE (scope) != FUNCTION_DECL)
1617 error ("braced-group within expression allowed only inside a function");
1618 YYERROR;
1620 if (pedantic)
1621 pedwarn ("ISO C++ forbids braced-groups within expressions");
1622 $<ttype>$ = begin_stmt_expr ();
1624 compstmt_or_stmtexpr ')'
1625 { $$ = finish_stmt_expr ($<ttype>2); }
1626 /* Koenig lookup support
1627 We could store lastiddecl in $1 to avoid another lookup,
1628 but that would result in many additional reduce/reduce conflicts. */
1629 | notype_unqualified_id '(' nonnull_exprlist ')'
1630 { $$ = finish_call_expr ($1, $3, 1); }
1631 | notype_unqualified_id LEFT_RIGHT
1632 { $$ = finish_call_expr ($1, NULL_TREE, 1); }
1633 | primary '(' nonnull_exprlist ')'
1634 { $$ = finish_call_expr ($1, $3, 0); }
1635 | primary LEFT_RIGHT
1636 { $$ = finish_call_expr ($1, NULL_TREE, 0); }
1637 | VA_ARG '(' expr_no_commas ',' type_id ')'
1638 { $$ = build_x_va_arg ($3, groktypename ($5.t));
1639 check_for_new_type ("__builtin_va_arg", $5); }
1640 | primary '[' expr ']'
1641 { $$ = grok_array_decl ($$, $3); }
1642 | primary PLUSPLUS
1643 { $$ = finish_increment_expr ($1, POSTINCREMENT_EXPR); }
1644 | primary MINUSMINUS
1645 { $$ = finish_increment_expr ($1, POSTDECREMENT_EXPR); }
1646 /* C++ extensions */
1647 | THIS
1648 { $$ = finish_this_expr (); }
1649 | CV_QUALIFIER '(' nonnull_exprlist ')'
1651 /* This is a C cast in C++'s `functional' notation
1652 using the "implicit int" extension so that:
1653 `const (3)' is equivalent to `const int (3)'. */
1654 tree type;
1656 type = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1657 type = groktypename (build_tree_list (type, NULL_TREE));
1658 $$ = build_functional_cast (type, $3);
1660 | functional_cast
1661 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1662 { tree type = groktypename ($3.t);
1663 check_for_new_type ("dynamic_cast", $3);
1664 $$ = build_dynamic_cast (type, $6); }
1665 | STATIC_CAST '<' type_id '>' '(' expr ')'
1666 { tree type = groktypename ($3.t);
1667 check_for_new_type ("static_cast", $3);
1668 $$ = build_static_cast (type, $6); }
1669 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1670 { tree type = groktypename ($3.t);
1671 check_for_new_type ("reinterpret_cast", $3);
1672 $$ = build_reinterpret_cast (type, $6); }
1673 | CONST_CAST '<' type_id '>' '(' expr ')'
1674 { tree type = groktypename ($3.t);
1675 check_for_new_type ("const_cast", $3);
1676 $$ = build_const_cast (type, $6); }
1677 | TYPEID '(' expr ')'
1678 { $$ = build_typeid ($3); }
1679 | TYPEID '(' type_id ')'
1680 { tree type = groktypename ($3.t);
1681 check_for_new_type ("typeid", $3);
1682 $$ = get_typeid (type); }
1683 | global_scope IDENTIFIER
1684 { $$ = do_scoped_id ($2, 1); }
1685 | global_scope template_id
1686 { $$ = $2; }
1687 | global_scope operator_name
1689 got_scope = NULL_TREE;
1690 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1691 $$ = do_scoped_id ($2, 1);
1692 else
1693 $$ = $2;
1695 | overqualified_id %prec HYPERUNARY
1696 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1697 | overqualified_id '(' nonnull_exprlist ')'
1698 { $$ = finish_qualified_call_expr ($1, $3); }
1699 | overqualified_id LEFT_RIGHT
1700 { $$ = finish_qualified_call_expr ($1, NULL_TREE); }
1701 | object object_template_id %prec UNARY
1703 $$ = build_x_component_ref ($$, $2, NULL_TREE, 1);
1705 | object object_template_id '(' nonnull_exprlist ')'
1706 { $$ = finish_object_call_expr ($2, $1, $4); }
1707 | object object_template_id LEFT_RIGHT
1708 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1709 | object unqualified_id %prec UNARY
1710 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1711 | object overqualified_id %prec UNARY
1712 { if (processing_template_decl)
1713 $$ = build_min_nt (COMPONENT_REF, $1, $2);
1714 else
1715 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1716 | object unqualified_id '(' nonnull_exprlist ')'
1717 { $$ = finish_object_call_expr ($2, $1, $4); }
1718 | object unqualified_id LEFT_RIGHT
1719 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1720 | object overqualified_id '(' nonnull_exprlist ')'
1721 { $$ = finish_qualified_object_call_expr ($2, $1, $4); }
1722 | object overqualified_id LEFT_RIGHT
1723 { $$ = finish_qualified_object_call_expr ($2, $1, NULL_TREE); }
1724 /* p->int::~int() is valid -- 12.4 */
1725 | object '~' TYPESPEC LEFT_RIGHT
1726 { $$ = finish_pseudo_destructor_call_expr ($1, NULL_TREE, $3); }
1727 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1728 { $$ = finish_pseudo_destructor_call_expr ($1, $2, $5); }
1729 | object error
1731 $$ = error_mark_node;
1735 /* Not needed for now.
1737 primary_no_id:
1738 '(' expr ')'
1739 { $$ = $2; }
1740 | '(' error ')'
1741 { $$ = error_mark_node; }
1742 | '('
1743 { if (current_function_decl == 0)
1745 error ("braced-group within expression allowed only inside a function");
1746 YYERROR;
1748 $<ttype>$ = expand_start_stmt_expr (); }
1749 compstmt_or_stmtexpr ')'
1750 { if (pedantic)
1751 pedwarn ("ISO C++ forbids braced-groups within expressions");
1752 $$ = expand_end_stmt_expr ($<ttype>2); }
1753 | primary_no_id '(' nonnull_exprlist ')'
1754 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1755 | primary_no_id LEFT_RIGHT
1756 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1757 | primary_no_id '[' expr ']'
1758 { goto do_array; }
1759 | primary_no_id PLUSPLUS
1760 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1761 | primary_no_id MINUSMINUS
1762 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1763 | SCOPE IDENTIFIER
1764 { goto do_scoped_id; }
1765 | SCOPE operator_name
1766 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1767 goto do_scoped_id;
1768 goto do_scoped_operator;
1773 new:
1775 { $$ = 0; }
1776 | global_scope NEW
1777 { got_scope = NULL_TREE; $$ = 1; }
1780 delete:
1781 DELETE
1782 { $$ = 0; }
1783 | global_scope delete
1784 { got_scope = NULL_TREE; $$ = 1; }
1787 boolean.literal:
1788 CXX_TRUE
1789 { $$ = boolean_true_node; }
1790 | CXX_FALSE
1791 { $$ = boolean_false_node; }
1794 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1795 string:
1796 STRING
1797 | string STRING
1798 { $$ = chainon ($$, $2); }
1801 nodecls:
1802 /* empty */
1804 if (DECL_CONSTRUCTOR_P (current_function_decl))
1805 finish_mem_initializers (NULL_TREE);
1809 object:
1810 primary '.'
1811 { got_object = TREE_TYPE ($$); }
1812 | primary POINTSAT
1814 $$ = build_x_arrow ($$);
1815 got_object = TREE_TYPE ($$);
1819 decl:
1820 typespec initdecls ';'
1822 if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1823 note_got_semicolon ($1.t);
1825 | typed_declspecs initdecls ';'
1827 note_list_got_semicolon ($1.t);
1829 | declmods notype_initdecls ';'
1831 | typed_declspecs ';'
1833 shadow_tag ($1.t);
1834 note_list_got_semicolon ($1.t);
1836 | declmods ';'
1837 { warning ("empty declaration"); }
1838 | extension decl
1839 { pedantic = $1; }
1842 /* Any kind of declarator (thus, all declarators allowed
1843 after an explicit typespec). */
1845 declarator:
1846 after_type_declarator %prec EMPTY
1847 | notype_declarator %prec EMPTY
1850 /* This is necessary to postpone reduction of `int()()()()'. */
1851 fcast_or_absdcl:
1852 LEFT_RIGHT %prec EMPTY
1853 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1854 NULL_TREE, NULL_TREE); }
1855 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1856 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1857 NULL_TREE); }
1860 /* ISO type-id (8.1) */
1861 type_id:
1862 typed_typespecs absdcl
1863 { $$.t = build_tree_list ($1.t, $2);
1864 $$.new_type_flag = $1.new_type_flag; }
1865 | nonempty_cv_qualifiers absdcl
1866 { $$.t = build_tree_list ($1.t, $2);
1867 $$.new_type_flag = $1.new_type_flag; }
1868 | typespec absdcl
1869 { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
1870 $2);
1871 $$.new_type_flag = $1.new_type_flag; }
1872 | typed_typespecs %prec EMPTY
1873 { $$.t = build_tree_list ($1.t, NULL_TREE);
1874 $$.new_type_flag = $1.new_type_flag; }
1875 | nonempty_cv_qualifiers %prec EMPTY
1876 { $$.t = build_tree_list ($1.t, NULL_TREE);
1877 $$.new_type_flag = $1.new_type_flag; }
1880 /* Declspecs which contain at least one type specifier or typedef name.
1881 (Just `const' or `volatile' is not enough.)
1882 A typedef'd name following these is taken as a name to be declared.
1883 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1885 typed_declspecs:
1886 typed_typespecs %prec EMPTY
1887 { $$.lookups = type_lookups; }
1888 | typed_declspecs1
1889 { $$.lookups = type_lookups; }
1892 typed_declspecs1:
1893 declmods typespec
1894 { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
1895 $$.new_type_flag = $2.new_type_flag; }
1896 | typespec reserved_declspecs %prec HYPERUNARY
1897 { $$.t = tree_cons (NULL_TREE, $1.t, $2);
1898 $$.new_type_flag = $1.new_type_flag; }
1899 | typespec reserved_typespecquals reserved_declspecs
1900 { $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1901 $$.new_type_flag = $1.new_type_flag; }
1902 | declmods typespec reserved_declspecs
1903 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1904 $$.new_type_flag = $2.new_type_flag; }
1905 | declmods typespec reserved_typespecquals
1906 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1907 $$.new_type_flag = $2.new_type_flag; }
1908 | declmods typespec reserved_typespecquals reserved_declspecs
1909 { $$.t = tree_cons (NULL_TREE, $2.t,
1910 chainon ($3, chainon ($4, $1.t)));
1911 $$.new_type_flag = $2.new_type_flag; }
1914 reserved_declspecs:
1915 SCSPEC
1916 { if (extra_warnings)
1917 warning ("`%s' is not at beginning of declaration",
1918 IDENTIFIER_POINTER ($$));
1919 $$ = build_tree_list (NULL_TREE, $$); }
1920 | reserved_declspecs typespecqual_reserved
1921 { $$ = tree_cons (NULL_TREE, $2.t, $$); }
1922 | reserved_declspecs SCSPEC
1923 { if (extra_warnings)
1924 warning ("`%s' is not at beginning of declaration",
1925 IDENTIFIER_POINTER ($2));
1926 $$ = tree_cons (NULL_TREE, $2, $$); }
1929 /* List of just storage classes and type modifiers.
1930 A declaration can start with just this, but then it cannot be used
1931 to redeclare a typedef-name.
1932 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1934 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1935 up on a persistent obstack. Otherwise, they could appear at the
1936 beginning of something like
1938 static const struct { int foo () { } } b;
1940 and would be discarded after we finish compiling foo. We don't need to
1941 worry once we see a type. */
1943 declmods:
1944 nonempty_cv_qualifiers %prec EMPTY
1945 { $$.lookups = NULL_TREE; TREE_STATIC ($$.t) = 1; }
1946 | SCSPEC
1948 $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1949 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1951 | declmods CV_QUALIFIER
1953 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1954 TREE_STATIC ($$.t) = 1;
1956 | declmods SCSPEC
1958 if (extra_warnings && TREE_STATIC ($$.t))
1959 warning ("`%s' is not at beginning of declaration",
1960 IDENTIFIER_POINTER ($2));
1961 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1962 TREE_STATIC ($$.t) = TREE_STATIC ($1.t);
1964 | declmods attributes
1965 { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t); }
1968 /* Used instead of declspecs where storage classes are not allowed
1969 (that is, for typenames and structure components).
1971 C++ can takes storage classes for structure components.
1972 Don't accept a typedef-name if anything but a modifier precedes it. */
1974 typed_typespecs:
1975 typespec %prec EMPTY
1976 { $$.t = build_tree_list (NULL_TREE, $1.t);
1977 $$.new_type_flag = $1.new_type_flag; }
1978 | nonempty_cv_qualifiers typespec
1979 { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
1980 $$.new_type_flag = $2.new_type_flag; }
1981 | typespec reserved_typespecquals
1982 { $$.t = tree_cons (NULL_TREE, $1.t, $2);
1983 $$.new_type_flag = $1.new_type_flag; }
1984 | nonempty_cv_qualifiers typespec reserved_typespecquals
1985 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1986 $$.new_type_flag = $2.new_type_flag; }
1989 reserved_typespecquals:
1990 typespecqual_reserved
1991 { $$ = build_tree_list (NULL_TREE, $1.t); }
1992 | reserved_typespecquals typespecqual_reserved
1993 { $$ = tree_cons (NULL_TREE, $2.t, $1); }
1994 | reserved_typespecquals attributes
1995 { $$ = tree_cons ($2, NULL_TREE, $1); }
1996 | attributes %prec EMPTY
1997 { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
2000 sizeof:
2001 SIZEOF { skip_evaluation++; }
2004 alignof:
2005 ALIGNOF { skip_evaluation++; }
2008 typeof:
2009 TYPEOF { skip_evaluation++; }
2012 /* A typespec (but not a type qualifier).
2013 Once we have seen one of these in a declaration,
2014 if a typedef name appears then it is being redeclared. */
2016 typespec:
2017 structsp
2018 { $$.lookups = NULL_TREE; }
2019 | TYPESPEC %prec EMPTY
2020 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
2021 | complete_type_name
2022 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
2023 | typeof '(' expr ')'
2024 { $$.t = finish_typeof ($3);
2025 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2026 skip_evaluation--; }
2027 | typeof '(' type_id ')'
2028 { $$.t = groktypename ($3.t);
2029 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2030 skip_evaluation--; }
2031 | SIGOF '(' expr ')'
2032 { tree type = TREE_TYPE ($3);
2034 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2035 if (IS_AGGR_TYPE (type))
2037 sorry ("sigof type specifier");
2038 $$.t = type;
2040 else
2042 error ("`sigof' applied to non-aggregate expression");
2043 $$.t = error_mark_node;
2046 | SIGOF '(' type_id ')'
2047 { tree type = groktypename ($3.t);
2049 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2050 if (IS_AGGR_TYPE (type))
2052 sorry ("sigof type specifier");
2053 $$.t = type;
2055 else
2057 error("`sigof' applied to non-aggregate type");
2058 $$.t = error_mark_node;
2063 /* A typespec that is a reserved word, or a type qualifier. */
2065 typespecqual_reserved:
2066 TYPESPEC
2067 { $$.t = $1; $$.new_type_flag = 0; }
2068 | CV_QUALIFIER
2069 { $$.t = $1; $$.new_type_flag = 0; }
2070 | structsp
2073 initdecls:
2074 initdcl0
2075 | initdecls ',' initdcl
2076 { check_multiple_declarators (); }
2079 notype_initdecls:
2080 notype_initdcl0
2081 | notype_initdecls ',' initdcl
2082 { check_multiple_declarators (); }
2085 nomods_initdecls:
2086 nomods_initdcl0
2087 | nomods_initdecls ',' initdcl
2088 { check_multiple_declarators (); }
2091 maybeasm:
2092 /* empty */
2093 { $$ = NULL_TREE; }
2094 | asm_keyword '(' string ')'
2095 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
2098 initdcl:
2099 declarator maybeasm maybe_attribute '='
2100 { $<ttype>$ = parse_decl ($<ttype>1, $3, 1); }
2101 init
2102 /* Note how the declaration of the variable is in effect while its init is parsed! */
2103 { parse_end_decl ($<ttype>5, $6, $2); }
2104 | declarator maybeasm maybe_attribute
2106 $<ttype>$ = parse_decl ($<ttype>1, $3, 0);
2107 parse_end_decl ($<ttype>$, NULL_TREE, $2);
2111 /* This rule assumes a certain configuration of the parser stack.
2112 In particular, $0, the element directly before the beginning of
2113 this rule on the stack, must be a maybeasm. $-1 must be a
2114 declarator or notype_declarator. And $-2 must be some declmods
2115 or declspecs. We can't move the maybeasm into this rule because
2116 we need that reduce so we prefer fn.def1 when appropriate. */
2117 initdcl0_innards:
2118 maybe_attribute '='
2119 { $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
2120 $<ftype>-2.lookups, $1, 1); }
2121 /* Note how the declaration of the variable is in effect
2122 while its init is parsed! */
2123 init
2124 { parse_end_decl ($<ttype>3, $4, $<ttype>0); }
2125 | maybe_attribute
2126 { tree d = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
2127 $<ftype>-2.lookups, $1, 0);
2128 parse_end_decl (d, NULL_TREE, $<ttype>0); }
2131 initdcl0:
2132 declarator maybeasm initdcl0_innards
2136 notype_initdcl0:
2137 notype_declarator maybeasm initdcl0_innards
2141 nomods_initdcl0:
2142 notype_declarator maybeasm
2143 { /* Set things up as initdcl0_innards expects. */
2144 $<ttype>$ = $2;
2145 $2 = $1;
2146 $<ftype>1.t = NULL_TREE;
2147 $<ftype>1.lookups = NULL_TREE; }
2148 initdcl0_innards
2150 | constructor_declarator maybeasm maybe_attribute
2151 { tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0);
2152 parse_end_decl (d, NULL_TREE, $2); }
2155 /* the * rules are dummies to accept the Apollo extended syntax
2156 so that the header files compile. */
2157 maybe_attribute:
2158 /* empty */
2159 { $$ = NULL_TREE; }
2160 | attributes
2161 { $$ = $1; }
2164 attributes:
2165 attribute
2166 { $$ = $1; }
2167 | attributes attribute
2168 { $$ = chainon ($1, $2); }
2171 attribute:
2172 ATTRIBUTE '(' '(' attribute_list ')' ')'
2173 { $$ = $4; }
2176 attribute_list:
2177 attrib
2178 { $$ = $1; }
2179 | attribute_list ',' attrib
2180 { $$ = chainon ($1, $3); }
2183 attrib:
2184 /* empty */
2185 { $$ = NULL_TREE; }
2186 | any_word
2187 { $$ = build_tree_list ($1, NULL_TREE); }
2188 | any_word '(' IDENTIFIER ')'
2189 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2190 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2191 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2192 | any_word '(' nonnull_exprlist ')'
2193 { $$ = build_tree_list ($1, $3); }
2196 /* This still leaves out most reserved keywords,
2197 shouldn't we include them? */
2199 any_word:
2200 identifier
2201 | SCSPEC
2202 | TYPESPEC
2203 | CV_QUALIFIER
2206 /* A nonempty list of identifiers, including typenames. */
2207 identifiers_or_typenames:
2208 identifier
2209 { $$ = build_tree_list (NULL_TREE, $1); }
2210 | identifiers_or_typenames ',' identifier
2211 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2214 maybe_init:
2215 /* empty */ %prec EMPTY
2216 { $$ = NULL_TREE; }
2217 | '=' init
2218 { $$ = $2; }
2221 /* If we are processing a template, we don't want to expand this
2222 initializer yet. */
2224 init:
2225 expr_no_commas %prec '='
2226 | '{' '}'
2227 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2228 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2229 | '{' initlist '}'
2230 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2231 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2232 | '{' initlist ',' '}'
2233 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2234 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2235 | error
2236 { $$ = NULL_TREE; }
2239 /* This chain is built in reverse order,
2240 and put in forward order where initlist is used. */
2241 initlist:
2242 init
2243 { $$ = build_tree_list (NULL_TREE, $$); }
2244 | initlist ',' init
2245 { $$ = tree_cons (NULL_TREE, $3, $$); }
2246 /* These are for labeled elements. */
2247 | '[' expr_no_commas ']' init
2248 { $$ = build_tree_list ($2, $4); }
2249 | identifier ':' init
2250 { $$ = build_tree_list ($$, $3); }
2251 | initlist ',' identifier ':' init
2252 { $$ = tree_cons ($3, $5, $$); }
2255 pending_inline:
2256 PRE_PARSED_FUNCTION_DECL maybe_return_init function_body
2258 expand_body (finish_function (2));
2259 process_next_inline ($1);
2261 | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
2263 expand_body (finish_function (2));
2264 process_next_inline ($1);
2266 | PRE_PARSED_FUNCTION_DECL maybe_return_init error
2268 finish_function (2);
2269 process_next_inline ($1); }
2272 pending_inlines:
2273 /* empty */
2274 | pending_inlines pending_inline eat_saved_input
2277 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2278 the TREE_LIST node for the parameter in question. */
2279 defarg_again:
2280 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2281 { replace_defarg ($1, $2); }
2282 | DEFARG_MARKER error END_OF_SAVED_INPUT
2283 { replace_defarg ($1, error_mark_node); }
2286 pending_defargs:
2287 /* empty */ %prec EMPTY
2288 | pending_defargs defarg_again
2289 { do_pending_defargs (); }
2290 | pending_defargs error
2291 { do_pending_defargs (); }
2294 structsp:
2295 ENUM identifier '{'
2296 { $<ttype>$ = current_enum_type;
2297 current_enum_type = start_enum ($2); }
2298 enumlist_opt '}'
2299 { $$.t = current_enum_type;
2300 finish_enum (current_enum_type);
2301 $$.new_type_flag = 1;
2302 current_enum_type = $<ttype>4;
2303 check_for_missing_semicolon ($$.t); }
2304 | ENUM '{'
2305 { $<ttype>$ = current_enum_type;
2306 current_enum_type = start_enum (make_anon_name ()); }
2307 enumlist_opt '}'
2308 { $$.t = current_enum_type;
2309 finish_enum (current_enum_type);
2310 $$.new_type_flag = 1;
2311 current_enum_type = $<ttype>3;
2312 check_for_missing_semicolon ($$.t); }
2313 | ENUM identifier
2314 { $$.t = xref_tag (enum_type_node, $2, 1);
2315 $$.new_type_flag = 0; }
2316 | ENUM complex_type_name
2317 { $$.t = xref_tag (enum_type_node, $2, 1);
2318 $$.new_type_flag = 0; }
2319 | TYPENAME_KEYWORD typename_sub
2320 { $$.t = $2;
2321 $$.new_type_flag = 0;
2322 if (!processing_template_decl)
2323 pedwarn ("using `typename' outside of template"); }
2324 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2325 | class_head_defn maybe_base_class_list '{'
2327 if ($2 && $1.t != error_mark_node)
2329 tree type = TREE_TYPE ($1.t);
2331 if (TREE_CODE (type) == TYPENAME_TYPE)
2332 /* In a definition of a member class template,
2333 we will get here with an implicit typename,
2334 a TYPENAME_TYPE with a type. */
2335 type = TREE_TYPE (type);
2336 maybe_process_partial_specialization (type);
2337 xref_basetypes (current_aggr, $1.t, type, $2);
2339 $1.t = begin_class_definition (TREE_TYPE ($1.t));
2340 check_class_key (current_aggr, $1.t);
2341 current_aggr = NULL_TREE; }
2342 opt.component_decl_list '}' maybe_attribute
2344 int semi;
2345 tree t;
2347 if (yychar == YYEMPTY)
2348 yychar = YYLEX;
2349 semi = yychar == ';';
2351 t = finish_class_definition ($1.t, $7, semi, $1.new_type_flag);
2352 $<ttype>$ = t;
2354 /* restore current_aggr */
2355 current_aggr = TREE_CODE (t) != RECORD_TYPE
2356 ? union_type_node
2357 : CLASSTYPE_DECLARED_CLASS (t)
2358 ? class_type_node : record_type_node;
2360 pending_defargs
2362 done_pending_defargs ();
2363 begin_inline_definitions ();
2365 pending_inlines
2367 finish_inline_definitions ();
2368 $$.t = $<ttype>8;
2369 $$.new_type_flag = 1;
2371 | class_head_decl
2373 $$.t = TREE_TYPE ($1.t);
2374 $$.new_type_flag = $1.new_type_flag;
2375 check_class_key (current_aggr, $$.t);
2379 maybecomma:
2380 /* empty */
2381 | ','
2384 maybecomma_warn:
2385 /* empty */
2386 | ','
2387 { if (pedantic && !in_system_header)
2388 pedwarn ("comma at end of enumerator list"); }
2391 aggr:
2392 AGGR
2393 | aggr SCSPEC
2394 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2395 | aggr TYPESPEC
2396 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2397 | aggr CV_QUALIFIER
2398 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2399 | aggr AGGR
2400 { error ("no body nor ';' separates two class, struct or union declarations"); }
2401 | aggr attributes
2402 { $$ = build_tree_list ($2, $1); }
2405 class_head:
2406 aggr identifier
2408 current_aggr = $1;
2409 $$ = build_tree_list (NULL_TREE, $2);
2411 | aggr nested_name_specifier identifier
2413 current_aggr = $1;
2414 $$ = build_tree_list ($2, $3);
2416 | aggr global_scope nested_name_specifier identifier
2418 current_aggr = $1;
2419 $$ = build_tree_list ($3, $4);
2421 | aggr global_scope identifier
2423 current_aggr = $1;
2424 $$ = build_tree_list (global_namespace, $3);
2428 class_head_apparent_template:
2429 aggr apparent_template_type
2431 current_aggr = $1;
2432 $$ = $2;
2434 | aggr nested_name_specifier apparent_template_type
2436 current_aggr = $1;
2437 $$ = $3;
2439 | aggr global_scope nested_name_specifier apparent_template_type
2441 current_aggr = $1;
2442 $$ = $4;
2446 class_head_decl:
2447 class_head %prec EMPTY
2449 $$.t = handle_class_head (current_aggr,
2450 TREE_PURPOSE ($1), TREE_VALUE ($1),
2451 0, &$$.new_type_flag);
2453 | aggr identifier_defn %prec EMPTY
2455 current_aggr = $1;
2456 $$.t = TYPE_MAIN_DECL (xref_tag (current_aggr, $2, 0));
2457 $$.new_type_flag = 1;
2459 | class_head_apparent_template %prec EMPTY
2461 $$.t = $1;
2462 $$.new_type_flag = 0;
2466 class_head_defn:
2467 class_head '{'
2469 yyungetc ('{', 1);
2470 $$.t = handle_class_head (current_aggr,
2471 TREE_PURPOSE ($1), TREE_VALUE ($1),
2472 1, &$$.new_type_flag);
2474 | class_head ':'
2476 yyungetc (':', 1);
2477 $$.t = handle_class_head (current_aggr,
2478 TREE_PURPOSE ($1), TREE_VALUE ($1),
2479 1, &$$.new_type_flag);
2481 | class_head_apparent_template '{'
2483 yyungetc ('{', 1);
2484 $$.t = $1;
2485 $$.new_type_flag = 0;
2486 if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
2487 /* We might be specializing a template with a different
2488 class-key. */
2489 CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
2490 = (current_aggr == class_type_node);
2492 | class_head_apparent_template ':'
2494 yyungetc (':', 1);
2495 $$.t = $1;
2496 $$.new_type_flag = 0;
2497 if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
2498 /* We might be specializing a template with a different
2499 class-key. */
2500 CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
2501 = (current_aggr == class_type_node);
2503 | aggr identifier_defn '{'
2505 yyungetc ('{', 1);
2506 current_aggr = $1;
2507 $$.t = handle_class_head (current_aggr,
2508 NULL_TREE, $2,
2509 1, &$$.new_type_flag);
2511 | aggr identifier_defn ':'
2513 yyungetc (':', 1);
2514 current_aggr = $1;
2515 $$.t = handle_class_head (current_aggr,
2516 NULL_TREE, $2,
2517 1, &$$.new_type_flag);
2519 | aggr '{'
2521 current_aggr = $1;
2522 $$.t = TYPE_MAIN_DECL (xref_tag ($1, make_anon_name (), 0));
2523 $$.new_type_flag = 0;
2524 CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($$.t))
2525 = $1 == class_type_node;
2526 yyungetc ('{', 1);
2530 maybe_base_class_list:
2531 /* empty */
2532 { $$ = NULL_TREE; }
2533 | ':' see_typename
2534 { error ("no bases given following `:'");
2535 $$ = NULL_TREE; }
2536 | ':' see_typename base_class_list
2537 { $$ = $3; }
2540 base_class_list:
2541 base_class
2542 | base_class_list ',' see_typename base_class
2543 { $$ = chainon ($$, $4); }
2546 base_class:
2547 base_class.1
2548 { $$ = finish_base_specifier (access_default_node, $1); }
2549 | base_class_access_list see_typename base_class.1
2550 { $$ = finish_base_specifier ($1, $3); }
2553 base_class.1:
2554 typename_sub
2555 { if (!TYPE_P ($$))
2556 $$ = error_mark_node; }
2557 | nonnested_type
2558 { $$ = TREE_TYPE ($$); }
2561 base_class_access_list:
2562 VISSPEC see_typename
2563 | SCSPEC see_typename
2564 { if ($1 != ridpointers[(int)RID_VIRTUAL])
2565 error ("`%D' access", $1);
2566 $$ = access_default_virtual_node; }
2567 | base_class_access_list VISSPEC see_typename
2569 if ($1 != access_default_virtual_node)
2570 error ("multiple access specifiers");
2571 else if ($2 == access_public_node)
2572 $$ = access_public_virtual_node;
2573 else if ($2 == access_protected_node)
2574 $$ = access_protected_virtual_node;
2575 else /* $2 == access_private_node */
2576 $$ = access_private_virtual_node;
2578 | base_class_access_list SCSPEC see_typename
2579 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2580 error ("`%D' access", $2);
2581 else if ($$ == access_public_node)
2582 $$ = access_public_virtual_node;
2583 else if ($$ == access_protected_node)
2584 $$ = access_protected_virtual_node;
2585 else if ($$ == access_private_node)
2586 $$ = access_private_virtual_node;
2587 else
2588 error ("multiple `virtual' specifiers");
2592 opt.component_decl_list:
2593 | component_decl_list
2594 | opt.component_decl_list access_specifier component_decl_list
2595 | opt.component_decl_list access_specifier
2598 access_specifier:
2599 VISSPEC ':'
2601 current_access_specifier = $1;
2605 /* Note: we no longer warn about the semicolon after a component_decl_list.
2606 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2607 component_decl_list:
2608 component_decl
2610 finish_member_declaration ($1);
2611 current_aggr = NULL_TREE;
2612 reset_type_access_control ();
2614 | component_decl_list component_decl
2616 finish_member_declaration ($2);
2617 current_aggr = NULL_TREE;
2618 reset_type_access_control ();
2622 component_decl:
2623 component_decl_1 ';'
2624 | component_decl_1 '}'
2625 { error ("missing ';' before right brace");
2626 yyungetc ('}', 0); }
2627 /* C++: handle constructors, destructors and inline functions */
2628 /* note that INLINE is like a TYPESPEC */
2629 | fn.def2 ':' /* base_init compstmt */
2630 { $$ = finish_method ($$); }
2631 | fn.def2 TRY /* base_init compstmt */
2632 { $$ = finish_method ($$); }
2633 | fn.def2 RETURN_KEYWORD /* base_init compstmt */
2634 { $$ = finish_method ($$); }
2635 | fn.def2 '{' /* nodecls compstmt */
2636 { $$ = finish_method ($$); }
2637 | ';'
2638 { $$ = NULL_TREE; }
2639 | extension component_decl
2640 { $$ = $2;
2641 pedantic = $1; }
2642 | template_header component_decl
2644 if ($2)
2645 $$ = finish_member_template_decl ($2);
2646 else
2647 /* The component was already processed. */
2648 $$ = NULL_TREE;
2650 finish_template_decl ($1);
2652 | template_header typed_declspecs ';'
2654 $$ = finish_member_class_template ($2.t);
2655 finish_template_decl ($1);
2657 | bad_decl
2658 { $$ = NULL_TREE; }
2661 component_decl_1:
2662 /* Do not add a "typed_declspecs declarator" rule here for
2663 speed; we need to call grok_x_components for enums, so the
2664 speedup would be insignificant. */
2665 typed_declspecs components
2667 /* Most of the productions for component_decl only
2668 allow the creation of one new member, so we call
2669 finish_member_declaration in component_decl_list.
2670 For this rule and the next, however, there can be
2671 more than one member, e.g.:
2673 int i, j;
2675 and we need the first member to be fully
2676 registered before the second is processed.
2677 Therefore, the rules for components take care of
2678 this processing. To avoid registering the
2679 components more than once, we send NULL_TREE up
2680 here; that lets finish_member_declaration know
2681 that there is nothing to do. */
2682 if (!$2)
2683 grok_x_components ($1.t);
2684 $$ = NULL_TREE;
2686 | declmods notype_components
2688 if (!$2)
2689 grok_x_components ($1.t);
2690 $$ = NULL_TREE;
2692 | notype_declarator maybeasm maybe_attribute maybe_init
2693 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2694 | constructor_declarator maybeasm maybe_attribute maybe_init
2695 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2696 | ':' expr_no_commas
2697 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2698 | error
2699 { $$ = NULL_TREE; }
2701 /* These rules introduce a reduce/reduce conflict; in
2702 typedef int foo, bar;
2703 class A {
2704 foo (bar);
2706 should "A::foo" be declared as a function or "A::bar" as a data
2707 member? In other words, is "bar" an after_type_declarator or a
2708 parmlist? */
2709 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2710 { tree specs, attrs;
2711 split_specs_attrs ($1.t, &specs, &attrs);
2712 $$ = grokfield ($2, specs, $5, $3,
2713 chainon ($4, attrs)); }
2714 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2715 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2716 | using_decl
2717 { $$ = do_class_using_decl ($1); }
2720 /* The case of exactly one component is handled directly by component_decl. */
2721 /* ??? Huh? ^^^ */
2722 components:
2723 /* empty: possibly anonymous */
2724 { $$ = 0; }
2725 | component_declarator0
2727 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2728 $1 = finish_member_template_decl ($1);
2729 finish_member_declaration ($1);
2730 $$ = 1;
2732 | components ',' component_declarator
2734 check_multiple_declarators ();
2735 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2736 $3 = finish_member_template_decl ($3);
2737 finish_member_declaration ($3);
2738 $$ = 2;
2742 notype_components:
2743 /* empty: possibly anonymous */
2744 { $$ = 0; }
2745 | notype_component_declarator0
2747 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2748 $1 = finish_member_template_decl ($1);
2749 finish_member_declaration ($1);
2750 $$ = 1;
2752 | notype_components ',' notype_component_declarator
2754 check_multiple_declarators ();
2755 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2756 $3 = finish_member_template_decl ($3);
2757 finish_member_declaration ($3);
2758 $$ = 2;
2762 component_declarator0:
2763 after_type_component_declarator0
2764 | notype_component_declarator0
2767 component_declarator:
2768 after_type_component_declarator
2769 | notype_component_declarator
2772 after_type_component_declarator0:
2773 after_type_declarator maybeasm maybe_attribute maybe_init
2774 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2775 $3, $2, $4); }
2776 | tTYPENAME ':' expr_no_commas maybe_attribute
2777 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2778 $4, $3); }
2781 notype_component_declarator0:
2782 notype_declarator maybeasm maybe_attribute maybe_init
2783 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2784 $3, $2, $4); }
2785 | constructor_declarator maybeasm maybe_attribute maybe_init
2786 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2787 $3, $2, $4); }
2788 | IDENTIFIER ':' expr_no_commas maybe_attribute
2789 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2790 $4, $3); }
2791 | ':' expr_no_commas maybe_attribute
2792 { $$ = parse_bitfield0 (NULL_TREE, $<ftype>0.t,
2793 $<ftype>0.lookups, $3, $2); }
2796 after_type_component_declarator:
2797 after_type_declarator maybeasm maybe_attribute maybe_init
2798 { $$ = parse_field ($1, $3, $2, $4); }
2799 | tTYPENAME ':' expr_no_commas maybe_attribute
2800 { $$ = parse_bitfield ($1, $4, $3); }
2803 notype_component_declarator:
2804 notype_declarator maybeasm maybe_attribute maybe_init
2805 { $$ = parse_field ($1, $3, $2, $4); }
2806 | IDENTIFIER ':' expr_no_commas maybe_attribute
2807 { $$ = parse_bitfield ($1, $4, $3); }
2808 | ':' expr_no_commas maybe_attribute
2809 { $$ = parse_bitfield (NULL_TREE, $3, $2); }
2812 enumlist_opt:
2813 enumlist maybecomma_warn
2814 | maybecomma_warn
2817 /* We chain the enumerators in reverse order.
2818 Because of the way enums are built, the order is
2819 insignificant. Take advantage of this fact. */
2821 enumlist:
2822 enumerator
2823 | enumlist ',' enumerator
2826 enumerator:
2827 identifier
2828 { build_enumerator ($1, NULL_TREE, current_enum_type); }
2829 | identifier '=' expr_no_commas
2830 { build_enumerator ($1, $3, current_enum_type); }
2833 /* ISO new-type-id (5.3.4) */
2834 new_type_id:
2835 type_specifier_seq new_declarator
2836 { $$.t = build_tree_list ($1.t, $2);
2837 $$.new_type_flag = $1.new_type_flag; }
2838 | type_specifier_seq %prec EMPTY
2839 { $$.t = build_tree_list ($1.t, NULL_TREE);
2840 $$.new_type_flag = $1.new_type_flag; }
2841 /* GNU extension to allow arrays of arbitrary types with
2842 non-constant dimension. */
2843 | '(' type_id ')' '[' expr ']'
2845 if (pedantic)
2846 pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new");
2847 $$.t = build_nt (ARRAY_REF, TREE_VALUE ($2.t), $5);
2848 $$.t = build_tree_list (TREE_PURPOSE ($2.t), $$.t);
2849 $$.new_type_flag = $2.new_type_flag;
2853 cv_qualifiers:
2854 /* empty */ %prec EMPTY
2855 { $$ = NULL_TREE; }
2856 | cv_qualifiers CV_QUALIFIER
2857 { $$ = tree_cons (NULL_TREE, $2, $$); }
2860 nonempty_cv_qualifiers:
2861 CV_QUALIFIER
2862 { $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
2863 $$.new_type_flag = 0; }
2864 | nonempty_cv_qualifiers CV_QUALIFIER
2865 { $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
2866 $$.new_type_flag = $1.new_type_flag; }
2867 | attributes %prec EMPTY
2868 { $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE);
2869 $$.new_type_flag = 0; }
2870 | nonempty_cv_qualifiers attributes %prec EMPTY
2871 { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t);
2872 $$.new_type_flag = $1.new_type_flag; }
2875 /* These rules must follow the rules for function declarations
2876 and component declarations. That way, longer rules are preferred. */
2878 /* An expression which will not live on the momentary obstack. */
2879 maybe_parmlist:
2880 '(' nonnull_exprlist ')'
2881 { $$ = $2; }
2882 | '(' parmlist ')'
2883 { $$ = $2; }
2884 | LEFT_RIGHT
2885 { $$ = empty_parms (); }
2886 | '(' error ')'
2887 { $$ = NULL_TREE; }
2890 /* A declarator that is allowed only after an explicit typespec. */
2892 after_type_declarator_intern:
2893 after_type_declarator
2894 | attributes after_type_declarator
2896 /* Provide support for '(' attributes '*' declarator ')'
2897 etc */
2898 $$ = tree_cons ($1, $2, NULL_TREE);
2902 /* may all be followed by prec '.' */
2903 after_type_declarator:
2904 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2905 { $$ = make_pointer_declarator ($2.t, $3); }
2906 | '&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2907 { $$ = make_reference_declarator ($2.t, $3); }
2908 | '*' after_type_declarator_intern %prec UNARY
2909 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2910 | '&' after_type_declarator_intern %prec UNARY
2911 { $$ = make_reference_declarator (NULL_TREE, $2); }
2912 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2913 { tree arg = make_pointer_declarator ($2, $3);
2914 $$ = build_nt (SCOPE_REF, $1, arg);
2916 | direct_after_type_declarator
2919 direct_after_type_declarator:
2920 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2921 { $$ = make_call_declarator ($$, $2, $3, $4); }
2922 | direct_after_type_declarator '[' expr ']'
2923 { $$ = build_nt (ARRAY_REF, $$, $3); }
2924 | direct_after_type_declarator '[' ']'
2925 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
2926 | '(' after_type_declarator_intern ')'
2927 { $$ = $2; }
2928 | nested_name_specifier type_name %prec EMPTY
2929 { push_nested_class ($1, 3);
2930 $$ = build_nt (SCOPE_REF, $$, $2);
2931 TREE_COMPLEXITY ($$) = current_class_depth; }
2932 | type_name %prec EMPTY
2935 nonnested_type:
2936 type_name %prec EMPTY
2938 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2940 $$ = lookup_name ($1, 1);
2941 maybe_note_name_used_in_class ($1, $$);
2943 else
2944 $$ = $1;
2946 | global_scope type_name
2948 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2949 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
2950 else
2951 $$ = $2;
2952 got_scope = NULL_TREE;
2956 complete_type_name:
2957 nonnested_type
2958 | nested_type
2959 | global_scope nested_type
2960 { $$ = $2; }
2963 nested_type:
2964 nested_name_specifier type_name %prec EMPTY
2965 { $$ = get_type_decl ($2); }
2968 /* A declarator allowed whether or not there has been
2969 an explicit typespec. These cannot redeclare a typedef-name. */
2971 notype_declarator_intern:
2972 notype_declarator
2973 | attributes notype_declarator
2975 /* Provide support for '(' attributes '*' declarator ')'
2976 etc */
2977 $$ = tree_cons ($1, $2, NULL_TREE);
2981 notype_declarator:
2982 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2983 { $$ = make_pointer_declarator ($2.t, $3); }
2984 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2985 { $$ = make_reference_declarator ($2.t, $3); }
2986 | '*' notype_declarator_intern %prec UNARY
2987 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2988 | '&' notype_declarator_intern %prec UNARY
2989 { $$ = make_reference_declarator (NULL_TREE, $2); }
2990 | ptr_to_mem cv_qualifiers notype_declarator_intern
2991 { tree arg = make_pointer_declarator ($2, $3);
2992 $$ = build_nt (SCOPE_REF, $1, arg);
2994 | direct_notype_declarator
2997 complex_notype_declarator:
2998 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2999 { $$ = make_pointer_declarator ($2.t, $3); }
3000 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
3001 { $$ = make_reference_declarator ($2.t, $3); }
3002 | '*' complex_notype_declarator %prec UNARY
3003 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3004 | '&' complex_notype_declarator %prec UNARY
3005 { $$ = make_reference_declarator (NULL_TREE, $2); }
3006 | ptr_to_mem cv_qualifiers notype_declarator_intern
3007 { tree arg = make_pointer_declarator ($2, $3);
3008 $$ = build_nt (SCOPE_REF, $1, arg);
3010 | complex_direct_notype_declarator
3013 complex_direct_notype_declarator:
3014 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
3015 { $$ = make_call_declarator ($$, $2, $3, $4); }
3016 | '(' complex_notype_declarator ')'
3017 { $$ = $2; }
3018 | direct_notype_declarator '[' expr ']'
3019 { $$ = build_nt (ARRAY_REF, $$, $3); }
3020 | direct_notype_declarator '[' ']'
3021 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
3022 | notype_qualified_id
3023 { enter_scope_of ($1); }
3024 | global_scope notype_qualified_id
3025 { enter_scope_of ($2); $$ = $2;}
3026 | global_scope notype_unqualified_id
3027 { $$ = build_nt (SCOPE_REF, global_namespace, $2);
3028 enter_scope_of ($$);
3030 | nested_name_specifier notype_template_declarator
3031 { got_scope = NULL_TREE;
3032 $$ = build_nt (SCOPE_REF, $1, $2);
3033 enter_scope_of ($$);
3037 qualified_id:
3038 nested_name_specifier unqualified_id
3039 { got_scope = NULL_TREE;
3040 $$ = build_nt (SCOPE_REF, $$, $2); }
3041 | nested_name_specifier object_template_id
3042 { got_scope = NULL_TREE;
3043 $$ = build_nt (SCOPE_REF, $1, $2); }
3046 notype_qualified_id:
3047 nested_name_specifier notype_unqualified_id
3048 { got_scope = NULL_TREE;
3049 $$ = build_nt (SCOPE_REF, $$, $2); }
3050 | nested_name_specifier object_template_id
3051 { got_scope = NULL_TREE;
3052 $$ = build_nt (SCOPE_REF, $1, $2); }
3055 overqualified_id:
3056 notype_qualified_id
3057 | global_scope notype_qualified_id
3058 { $$ = $2; }
3061 functional_cast:
3062 typespec '(' nonnull_exprlist ')'
3063 { $$ = build_functional_cast ($1.t, $3); }
3064 | typespec '(' expr_or_declarator_intern ')'
3065 { $$ = reparse_decl_as_expr ($1.t, $3); }
3066 | typespec fcast_or_absdcl %prec EMPTY
3067 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3070 type_name:
3071 tTYPENAME
3072 | SELFNAME
3073 | template_type %prec EMPTY
3076 nested_name_specifier:
3077 nested_name_specifier_1
3078 | nested_name_specifier nested_name_specifier_1
3079 { $$ = $2; }
3080 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
3081 { got_scope = $$
3082 = make_typename_type ($1, $3, tf_error); }
3083 /* Error handling per Core 125. */
3084 | nested_name_specifier IDENTIFIER SCOPE
3085 { got_scope = $$
3086 = make_typename_type ($1, $2, tf_error); }
3087 | nested_name_specifier PTYPENAME SCOPE
3088 { got_scope = $$
3089 = make_typename_type ($1, $2, tf_error); }
3092 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3093 inline here?!? (jason) */
3094 nested_name_specifier_1:
3095 tTYPENAME SCOPE
3097 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3099 $$ = lastiddecl;
3100 maybe_note_name_used_in_class ($1, $$);
3102 got_scope = $$ =
3103 complete_type (TYPE_MAIN_VARIANT (TREE_TYPE ($$)));
3105 | SELFNAME SCOPE
3107 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3108 $$ = lastiddecl;
3109 got_scope = $$ = TREE_TYPE ($$);
3111 | NSNAME SCOPE
3113 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3114 $$ = lastiddecl;
3115 got_scope = $$;
3117 | template_type SCOPE
3118 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3121 typename_sub:
3122 typename_sub0
3123 | global_scope typename_sub0
3124 { $$ = $2; }
3127 typename_sub0:
3128 typename_sub1 identifier %prec EMPTY
3130 if (TYPE_P ($1))
3131 $$ = make_typename_type ($1, $2, tf_error);
3132 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
3133 error ("`%T' is not a class or namespace", $2);
3134 else
3136 $$ = $2;
3137 if (TREE_CODE ($$) == TYPE_DECL)
3138 $$ = TREE_TYPE ($$);
3141 | typename_sub1 template_type %prec EMPTY
3142 { $$ = TREE_TYPE ($2); }
3143 | typename_sub1 explicit_template_type %prec EMPTY
3144 { $$ = make_typename_type ($1, $2, tf_error); }
3145 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
3146 { $$ = make_typename_type ($1, $3, tf_error); }
3149 typename_sub1:
3150 typename_sub2
3152 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3153 error ("`%T' is not a class or namespace", $1);
3154 else if (TREE_CODE ($1) == TYPE_DECL)
3155 $$ = TREE_TYPE ($1);
3157 | typename_sub1 typename_sub2
3159 if (TYPE_P ($1))
3160 $$ = make_typename_type ($1, $2, tf_error);
3161 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
3162 error ("`%T' is not a class or namespace", $2);
3163 else
3165 $$ = $2;
3166 if (TREE_CODE ($$) == TYPE_DECL)
3167 $$ = TREE_TYPE ($$);
3170 | typename_sub1 explicit_template_type SCOPE
3171 { got_scope = $$
3172 = make_typename_type ($1, $2, tf_error); }
3173 | typename_sub1 TEMPLATE explicit_template_type SCOPE
3174 { got_scope = $$
3175 = make_typename_type ($1, $3, tf_error); }
3178 /* This needs to return a TYPE_DECL for simple names so that we don't
3179 forget what name was used. */
3180 typename_sub2:
3181 tTYPENAME SCOPE
3183 if (TREE_CODE ($1) != TYPE_DECL)
3184 $$ = lastiddecl;
3186 /* Retrieve the type for the identifier, which might involve
3187 some computation. */
3188 got_scope = complete_type (TREE_TYPE ($$));
3190 if ($$ == error_mark_node)
3191 error ("`%T' is not a class or namespace", $1);
3193 | SELFNAME SCOPE
3195 if (TREE_CODE ($1) != TYPE_DECL)
3196 $$ = lastiddecl;
3197 got_scope = complete_type (TREE_TYPE ($$));
3199 | template_type SCOPE
3200 { got_scope = $$ = complete_type (TREE_TYPE ($$)); }
3201 | PTYPENAME SCOPE
3202 | IDENTIFIER SCOPE
3203 | NSNAME SCOPE
3205 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3206 $$ = lastiddecl;
3207 got_scope = $$;
3211 explicit_template_type:
3212 identifier '<' template_arg_list_opt template_close_bracket
3213 { $$ = build_min_nt (TEMPLATE_ID_EXPR, $1, $3); }
3216 complex_type_name:
3217 global_scope type_name
3219 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3220 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
3221 else
3222 $$ = $2;
3223 got_scope = NULL_TREE;
3225 | nested_type
3226 | global_scope nested_type
3227 { $$ = $2; }
3230 ptr_to_mem:
3231 nested_name_specifier '*'
3232 { got_scope = NULL_TREE; }
3233 | global_scope nested_name_specifier '*'
3234 { $$ = $2; got_scope = NULL_TREE; }
3237 /* All uses of explicit global scope must go through this nonterminal so
3238 that got_scope will be set before yylex is called to get the next token. */
3239 global_scope:
3240 SCOPE
3241 { got_scope = void_type_node; }
3244 /* ISO new-declarator (5.3.4) */
3245 new_declarator:
3246 '*' cv_qualifiers new_declarator
3247 { $$ = make_pointer_declarator ($2, $3); }
3248 | '*' cv_qualifiers %prec EMPTY
3249 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3250 | '&' cv_qualifiers new_declarator %prec EMPTY
3251 { $$ = make_reference_declarator ($2, $3); }
3252 | '&' cv_qualifiers %prec EMPTY
3253 { $$ = make_reference_declarator ($2, NULL_TREE); }
3254 | ptr_to_mem cv_qualifiers %prec EMPTY
3255 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3256 $$ = build_nt (SCOPE_REF, $1, arg);
3258 | ptr_to_mem cv_qualifiers new_declarator
3259 { tree arg = make_pointer_declarator ($2, $3);
3260 $$ = build_nt (SCOPE_REF, $1, arg);
3262 | direct_new_declarator %prec EMPTY
3265 /* ISO direct-new-declarator (5.3.4) */
3266 direct_new_declarator:
3267 '[' expr ']'
3268 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
3269 | direct_new_declarator '[' expr ']'
3270 { $$ = build_nt (ARRAY_REF, $$, $3); }
3273 absdcl_intern:
3274 absdcl
3275 | attributes absdcl
3277 /* Provide support for '(' attributes '*' declarator ')'
3278 etc */
3279 $$ = tree_cons ($1, $2, NULL_TREE);
3283 /* ISO abstract-declarator (8.1) */
3284 absdcl:
3285 '*' nonempty_cv_qualifiers absdcl_intern
3286 { $$ = make_pointer_declarator ($2.t, $3); }
3287 | '*' absdcl_intern
3288 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3289 | '*' nonempty_cv_qualifiers %prec EMPTY
3290 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3291 | '*' %prec EMPTY
3292 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3293 | '&' nonempty_cv_qualifiers absdcl_intern
3294 { $$ = make_reference_declarator ($2.t, $3); }
3295 | '&' absdcl_intern
3296 { $$ = make_reference_declarator (NULL_TREE, $2); }
3297 | '&' nonempty_cv_qualifiers %prec EMPTY
3298 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3299 | '&' %prec EMPTY
3300 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3301 | ptr_to_mem cv_qualifiers %prec EMPTY
3302 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3303 $$ = build_nt (SCOPE_REF, $1, arg);
3305 | ptr_to_mem cv_qualifiers absdcl_intern
3306 { tree arg = make_pointer_declarator ($2, $3);
3307 $$ = build_nt (SCOPE_REF, $1, arg);
3309 | direct_abstract_declarator %prec EMPTY
3312 /* ISO direct-abstract-declarator (8.1) */
3313 direct_abstract_declarator:
3314 '(' absdcl_intern ')'
3315 { $$ = $2; }
3316 /* `(typedef)1' is `int'. */
3317 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3318 { $$ = make_call_declarator ($$, $3, $5, $6); }
3319 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3320 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3321 | direct_abstract_declarator '[' expr ']' %prec '.'
3322 { $$ = build_nt (ARRAY_REF, $$, $3); }
3323 | direct_abstract_declarator '[' ']' %prec '.'
3324 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
3325 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3326 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3327 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3328 { set_quals_and_spec ($$, $2, $3); }
3329 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3330 { set_quals_and_spec ($$, $2, $3); }
3331 | '[' expr ']' %prec '.'
3332 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
3333 | '[' ']' %prec '.'
3334 { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
3337 /* For C++, decls and stmts can be intermixed, so we don't need to
3338 have a special rule that won't start parsing the stmt section
3339 until we have a stmt that parses without errors. */
3341 stmts:
3342 stmt
3343 | errstmt
3344 | stmts stmt
3345 | stmts errstmt
3348 errstmt:
3349 error ';'
3352 /* Read zero or more forward-declarations for labels
3353 that nested functions can jump to. */
3354 maybe_label_decls:
3355 /* empty */
3356 | label_decls
3357 { if (pedantic)
3358 pedwarn ("ISO C++ forbids label declarations"); }
3361 label_decls:
3362 label_decl
3363 | label_decls label_decl
3366 label_decl:
3367 LABEL identifiers_or_typenames ';'
3369 while ($2)
3371 finish_label_decl (TREE_VALUE ($2));
3372 $2 = TREE_CHAIN ($2);
3377 compstmt_or_stmtexpr:
3378 save_lineno '{'
3379 { $<ttype>$ = begin_compound_stmt (0); }
3380 compstmtend
3381 { STMT_LINENO ($<ttype>3) = $1;
3382 finish_compound_stmt (0, $<ttype>3); }
3385 compstmt:
3386 compstmt_or_stmtexpr
3387 { last_expr_type = NULL_TREE; }
3390 simple_if:
3392 { $<ttype>$ = begin_if_stmt ();
3393 cond_stmt_keyword = "if"; }
3394 paren_cond_or_null
3395 { finish_if_stmt_cond ($3, $<ttype>2); }
3396 implicitly_scoped_stmt
3397 { $$ = $<ttype>2;
3398 finish_then_clause ($<ttype>2); }
3401 implicitly_scoped_stmt:
3402 compstmt
3404 { $<ttype>$ = begin_compound_stmt (0); }
3405 save_lineno simple_stmt
3406 { STMT_LINENO ($<ttype>1) = $2;
3407 if ($3) STMT_LINENO ($3) = $2;
3408 finish_compound_stmt (0, $<ttype>1); }
3411 stmt:
3412 compstmt
3413 | save_lineno simple_stmt
3414 { if ($2) STMT_LINENO ($2) = $1; }
3417 simple_stmt:
3418 decl
3419 { finish_stmt ();
3420 $$ = NULL_TREE; }
3421 | expr ';'
3422 { $$ = finish_expr_stmt ($1); }
3423 | simple_if ELSE
3424 { begin_else_clause (); }
3425 implicitly_scoped_stmt
3427 $$ = $1;
3428 finish_else_clause ($1);
3429 finish_if_stmt ();
3431 | simple_if %prec IF
3432 { $$ = $1;
3433 finish_if_stmt (); }
3434 | WHILE
3436 $<ttype>$ = begin_while_stmt ();
3437 cond_stmt_keyword = "while";
3439 paren_cond_or_null
3440 { finish_while_stmt_cond ($3, $<ttype>2); }
3441 implicitly_scoped_stmt
3442 { $$ = $<ttype>2;
3443 finish_while_stmt ($<ttype>2); }
3444 | DO
3445 { $<ttype>$ = begin_do_stmt (); }
3446 implicitly_scoped_stmt WHILE
3448 finish_do_body ($<ttype>2);
3449 cond_stmt_keyword = "do";
3451 paren_expr_or_null ';'
3452 { $$ = $<ttype>2;
3453 finish_do_stmt ($6, $<ttype>2); }
3454 | FOR
3455 { $<ttype>$ = begin_for_stmt (); }
3456 '(' for.init.statement
3457 { finish_for_init_stmt ($<ttype>2); }
3458 xcond ';'
3459 { finish_for_cond ($6, $<ttype>2); }
3460 xexpr ')'
3461 { finish_for_expr ($9, $<ttype>2); }
3462 implicitly_scoped_stmt
3463 { $$ = $<ttype>2;
3464 finish_for_stmt ($<ttype>2); }
3465 | SWITCH
3466 { $<ttype>$ = begin_switch_stmt (); }
3467 '(' condition ')'
3468 { finish_switch_cond ($4, $<ttype>2); }
3469 implicitly_scoped_stmt
3470 { $$ = $<ttype>2;
3471 finish_switch_stmt ($<ttype>2); }
3472 | CASE expr_no_commas ':'
3473 { $<ttype>$ = finish_case_label ($2, NULL_TREE); }
3474 stmt
3475 { $$ = $<ttype>4; }
3476 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3477 { $<ttype>$ = finish_case_label ($2, $4); }
3478 stmt
3479 { $$ = $<ttype>6; }
3480 | DEFAULT ':'
3481 { $<ttype>$ = finish_case_label (NULL_TREE, NULL_TREE); }
3482 stmt
3483 { $$ = $<ttype>3; }
3484 | BREAK ';'
3485 { $$ = finish_break_stmt (); }
3486 | CONTINUE ';'
3487 { $$ = finish_continue_stmt (); }
3488 | RETURN_KEYWORD ';'
3489 { $$ = finish_return_stmt (NULL_TREE); }
3490 | RETURN_KEYWORD expr ';'
3491 { $$ = finish_return_stmt ($2); }
3492 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3493 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE,
3494 NULL_TREE);
3495 ASM_INPUT_P ($$) = 1; }
3496 /* This is the case with just output operands. */
3497 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3498 { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
3499 /* This is the case with input operands as well. */
3500 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3501 asm_operands ')' ';'
3502 { $$ = finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
3503 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ')' ';'
3504 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); }
3505 /* This is the case with clobbered registers as well. */
3506 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3507 asm_operands ':' asm_clobbers ')' ';'
3508 { $$ = finish_asm_stmt ($2, $4, $6, $8, $10); }
3509 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ':'
3510 asm_clobbers ')' ';'
3511 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); }
3512 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands SCOPE
3513 asm_clobbers ')' ';'
3514 { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
3515 | GOTO '*' expr ';'
3517 if (pedantic)
3518 pedwarn ("ISO C++ forbids computed gotos");
3519 $$ = finish_goto_stmt ($3);
3521 | GOTO identifier ';'
3522 { $$ = finish_goto_stmt ($2); }
3523 | label_colon stmt
3524 { $$ = NULL_TREE; }
3525 | label_colon '}'
3526 { error ("label must be followed by statement");
3527 yyungetc ('}', 0);
3528 $$ = NULL_TREE; }
3529 | ';'
3530 { finish_stmt ();
3531 $$ = NULL_TREE; }
3532 | try_block
3533 { $$ = NULL_TREE; }
3534 | using_directive
3535 { $$ = NULL_TREE; }
3536 | namespace_using_decl
3537 { do_local_using_decl ($1);
3538 $$ = NULL_TREE; }
3539 | namespace_alias
3540 { $$ = NULL_TREE; }
3543 function_try_block:
3545 { $<ttype>$ = begin_function_try_block (); }
3546 function_body
3547 { finish_function_try_block ($<ttype>2); }
3548 handler_seq
3549 { finish_function_handler_sequence ($<ttype>2); }
3552 try_block:
3554 { $<ttype>$ = begin_try_block (); }
3555 compstmt
3556 { finish_try_block ($<ttype>2); }
3557 handler_seq
3558 { finish_handler_sequence ($<ttype>2); }
3561 handler_seq:
3562 handler
3563 | handler_seq handler
3564 | /* empty */
3565 { /* Generate a fake handler block to avoid later aborts. */
3566 tree fake_handler = begin_handler ();
3567 finish_handler_parms (NULL_TREE, fake_handler);
3568 finish_handler (fake_handler);
3569 $<ttype>$ = fake_handler;
3571 error ("must have at least one catch per try block");
3575 handler:
3576 CATCH
3577 { $<ttype>$ = begin_handler (); }
3578 handler_args
3579 { finish_handler_parms ($3, $<ttype>2); }
3580 compstmt
3581 { finish_handler ($<ttype>2); }
3584 type_specifier_seq:
3585 typed_typespecs %prec EMPTY
3586 | nonempty_cv_qualifiers %prec EMPTY
3589 handler_args:
3590 '(' ELLIPSIS ')'
3591 { $$ = NULL_TREE; }
3592 /* This doesn't allow reference parameters, the below does.
3593 | '(' type_specifier_seq absdcl ')'
3594 { check_for_new_type ("inside exception declarations", $2);
3595 expand_start_catch_block ($2.t, $3); }
3596 | '(' type_specifier_seq ')'
3597 { check_for_new_type ("inside exception declarations", $2);
3598 expand_start_catch_block ($2.t, NULL_TREE); }
3599 | '(' type_specifier_seq notype_declarator ')'
3600 { check_for_new_type ("inside exception declarations", $2);
3601 expand_start_catch_block ($2.t, $3); }
3602 | '(' typed_typespecs after_type_declarator ')'
3603 { check_for_new_type ("inside exception declarations", $2);
3604 expand_start_catch_block ($2.t, $3); }
3605 This allows reference parameters... */
3606 | '(' parm ')'
3608 check_for_new_type ("inside exception declarations", $2);
3609 $$ = start_handler_parms (TREE_PURPOSE ($2.t),
3610 TREE_VALUE ($2.t));
3614 label_colon:
3615 IDENTIFIER ':'
3616 { finish_label_stmt ($1); }
3617 | PTYPENAME ':'
3618 { finish_label_stmt ($1); }
3619 | tTYPENAME ':'
3620 { finish_label_stmt ($1); }
3621 | SELFNAME ':'
3622 { finish_label_stmt ($1); }
3625 for.init.statement:
3626 xexpr ';'
3627 { finish_expr_stmt ($1); }
3628 | decl
3629 | '{' compstmtend
3630 { if (pedantic)
3631 pedwarn ("ISO C++ forbids compound statements inside for initializations");
3635 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3637 maybe_cv_qualifier:
3638 /* empty */
3639 { $$ = NULL_TREE; }
3640 | CV_QUALIFIER
3643 xexpr:
3644 /* empty */
3645 { $$ = NULL_TREE; }
3646 | expr
3647 | error
3648 { $$ = NULL_TREE; }
3651 /* These are the operands other than the first string and colon
3652 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3653 asm_operands:
3654 /* empty */
3655 { $$ = NULL_TREE; }
3656 | nonnull_asm_operands
3659 nonnull_asm_operands:
3660 asm_operand
3661 | nonnull_asm_operands ',' asm_operand
3662 { $$ = chainon ($$, $3); }
3665 asm_operand:
3666 STRING '(' expr ')'
3667 { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
3668 | '[' identifier ']' STRING '(' expr ')'
3669 { $$ = build_tree_list (build_tree_list ($2, $4), $6); }
3672 asm_clobbers:
3673 string
3674 { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE);}
3675 | asm_clobbers ',' string
3676 { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
3679 /* This is what appears inside the parens in a function declarator.
3680 Its value is represented in the format that grokdeclarator expects.
3682 In C++, declaring a function with no parameters
3683 means that that function takes *no* parameters. */
3685 parmlist:
3686 /* empty */
3688 $$ = empty_parms();
3690 | complex_parmlist
3691 | type_id
3692 { $$ = finish_parmlist (build_tree_list (NULL_TREE, $1.t), 0);
3693 check_for_new_type ("inside parameter list", $1); }
3696 /* This nonterminal does not include the common sequence '(' type_id ')',
3697 as it is ambiguous and must be disambiguated elsewhere. */
3698 complex_parmlist:
3699 parms
3700 { $$ = finish_parmlist ($$, 0); }
3701 | parms_comma ELLIPSIS
3702 { $$ = finish_parmlist ($1, 1); }
3703 /* C++ allows an ellipsis without a separating ',' */
3704 | parms ELLIPSIS
3705 { $$ = finish_parmlist ($1, 1); }
3706 | type_id ELLIPSIS
3707 { $$ = finish_parmlist (build_tree_list (NULL_TREE,
3708 $1.t), 1); }
3709 | ELLIPSIS
3710 { $$ = finish_parmlist (NULL_TREE, 1); }
3711 | parms ':'
3713 /* This helps us recover from really nasty
3714 parse errors, for example, a missing right
3715 parenthesis. */
3716 yyerror ("possibly missing ')'");
3717 $$ = finish_parmlist ($1, 0);
3718 yyungetc (':', 0);
3719 yychar = ')';
3721 | type_id ':'
3723 /* This helps us recover from really nasty
3724 parse errors, for example, a missing right
3725 parenthesis. */
3726 yyerror ("possibly missing ')'");
3727 $$ = finish_parmlist (build_tree_list (NULL_TREE,
3728 $1.t), 0);
3729 yyungetc (':', 0);
3730 yychar = ')';
3734 /* A default argument to a */
3735 defarg:
3737 { maybe_snarf_defarg (); }
3738 defarg1
3739 { $$ = $3; }
3742 defarg1:
3743 DEFARG
3744 | init
3747 /* A nonempty list of parameter declarations or type names. */
3748 parms:
3749 named_parm
3750 { check_for_new_type ("in a parameter list", $1);
3751 $$ = build_tree_list (NULL_TREE, $1.t); }
3752 | parm defarg
3753 { check_for_new_type ("in a parameter list", $1);
3754 $$ = build_tree_list ($2, $1.t); }
3755 | parms_comma full_parm
3756 { check_for_new_type ("in a parameter list", $2);
3757 $$ = chainon ($$, $2.t); }
3758 | parms_comma bad_parm
3759 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
3760 | parms_comma bad_parm '=' init
3761 { $$ = chainon ($$, build_tree_list ($4, $2)); }
3764 parms_comma:
3765 parms ','
3766 | type_id ','
3767 { check_for_new_type ("in a parameter list", $1);
3768 $$ = build_tree_list (NULL_TREE, $1.t); }
3771 /* A single parameter declaration or parameter type name,
3772 as found in a parmlist. */
3773 named_parm:
3774 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3775 TYPESPEC IDENTIFIER. */
3776 typed_declspecs1 declarator
3777 { $$.new_type_flag = $1.new_type_flag;
3778 $$.t = build_tree_list ($1.t, $2); }
3779 | typed_typespecs declarator
3780 { $$.t = build_tree_list ($1.t, $2);
3781 $$.new_type_flag = $1.new_type_flag; }
3782 | typespec declarator
3783 { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
3784 $2);
3785 $$.new_type_flag = $1.new_type_flag; }
3786 | typed_declspecs1 absdcl
3787 { $$.t = build_tree_list ($1.t, $2);
3788 $$.new_type_flag = $1.new_type_flag; }
3789 | typed_declspecs1 %prec EMPTY
3790 { $$.t = build_tree_list ($1.t, NULL_TREE);
3791 $$.new_type_flag = $1.new_type_flag; }
3792 | declmods notype_declarator
3793 { $$.t = build_tree_list ($1.t, $2);
3794 $$.new_type_flag = 0; }
3797 full_parm:
3798 parm
3799 { $$.t = build_tree_list (NULL_TREE, $1.t);
3800 $$.new_type_flag = $1.new_type_flag; }
3801 | parm defarg
3802 { $$.t = build_tree_list ($2, $1.t);
3803 $$.new_type_flag = $1.new_type_flag; }
3806 parm:
3807 named_parm
3808 | type_id
3811 see_typename:
3812 /* empty */ %prec EMPTY
3813 { see_typename (); }
3816 bad_parm:
3817 /* empty */ %prec EMPTY
3819 error ("type specifier omitted for parameter");
3820 $$ = build_tree_list (integer_type_node, NULL_TREE);
3822 | notype_declarator
3824 if (TREE_CODE ($$) == SCOPE_REF)
3826 if (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM
3827 || TREE_CODE (TREE_OPERAND ($$, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM)
3828 error ("`%E' is not a type, use `typename %E' to make it one", $$, $$);
3829 else
3830 error ("no type `%D' in `%T'", TREE_OPERAND ($$, 1), TREE_OPERAND ($$, 0));
3832 else
3833 error ("type specifier omitted for parameter `%E'", $$);
3834 $$ = build_tree_list (integer_type_node, $$);
3838 bad_decl:
3839 IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore ';'
3841 error("'%D' is used as a type, but is not defined as a type.", $1);
3842 $3 = error_mark_node;
3846 template_arg_list_ignore:
3847 '<' template_arg_list_opt template_close_bracket
3849 | /* empty */
3852 arg_list_ignore:
3853 '(' nonnull_exprlist ')'
3855 | /* empty */
3858 exception_specification_opt:
3859 /* empty */ %prec EMPTY
3860 { $$ = NULL_TREE; }
3861 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
3862 { $$ = $3; }
3863 | THROW LEFT_RIGHT %prec EMPTY
3864 { $$ = empty_except_spec; }
3867 ansi_raise_identifier:
3868 type_id
3870 check_for_new_type ("exception specifier", $1);
3871 $$ = groktypename ($1.t);
3873 | error
3874 { $$ = error_mark_node; }
3877 ansi_raise_identifiers:
3878 ansi_raise_identifier
3879 { $$ = add_exception_specifier (NULL_TREE, $1, 1); }
3880 | ansi_raise_identifiers ',' ansi_raise_identifier
3881 { $$ = add_exception_specifier ($1, $3, 1); }
3884 conversion_declarator:
3885 /* empty */ %prec EMPTY
3886 { $$ = NULL_TREE; }
3887 | '*' cv_qualifiers conversion_declarator
3888 { $$ = make_pointer_declarator ($2, $3); }
3889 | '&' cv_qualifiers conversion_declarator
3890 { $$ = make_reference_declarator ($2, $3); }
3891 | ptr_to_mem cv_qualifiers conversion_declarator
3892 { tree arg = make_pointer_declarator ($2, $3);
3893 $$ = build_nt (SCOPE_REF, $1, arg);
3897 operator:
3898 OPERATOR
3900 saved_scopes = tree_cons (got_scope, got_object, saved_scopes);
3901 TREE_LANG_FLAG_0 (saved_scopes) = looking_for_typename;
3902 /* We look for conversion-type-id's in both the class and current
3903 scopes, just as for ID in 'ptr->ID::'. */
3904 looking_for_typename = 1;
3905 got_object = got_scope;
3906 got_scope = NULL_TREE;
3910 unoperator:
3911 { got_scope = TREE_PURPOSE (saved_scopes);
3912 got_object = TREE_VALUE (saved_scopes);
3913 looking_for_typename = TREE_LANG_FLAG_0 (saved_scopes);
3914 saved_scopes = TREE_CHAIN (saved_scopes);
3918 operator_name:
3919 operator '*' unoperator
3920 { $$ = frob_opname (ansi_opname (MULT_EXPR)); }
3921 | operator '/' unoperator
3922 { $$ = frob_opname (ansi_opname (TRUNC_DIV_EXPR)); }
3923 | operator '%' unoperator
3924 { $$ = frob_opname (ansi_opname (TRUNC_MOD_EXPR)); }
3925 | operator '+' unoperator
3926 { $$ = frob_opname (ansi_opname (PLUS_EXPR)); }
3927 | operator '-' unoperator
3928 { $$ = frob_opname (ansi_opname (MINUS_EXPR)); }
3929 | operator '&' unoperator
3930 { $$ = frob_opname (ansi_opname (BIT_AND_EXPR)); }
3931 | operator '|' unoperator
3932 { $$ = frob_opname (ansi_opname (BIT_IOR_EXPR)); }
3933 | operator '^' unoperator
3934 { $$ = frob_opname (ansi_opname (BIT_XOR_EXPR)); }
3935 | operator '~' unoperator
3936 { $$ = frob_opname (ansi_opname (BIT_NOT_EXPR)); }
3937 | operator ',' unoperator
3938 { $$ = frob_opname (ansi_opname (COMPOUND_EXPR)); }
3939 | operator ARITHCOMPARE unoperator
3940 { $$ = frob_opname (ansi_opname ($2)); }
3941 | operator '<' unoperator
3942 { $$ = frob_opname (ansi_opname (LT_EXPR)); }
3943 | operator '>' unoperator
3944 { $$ = frob_opname (ansi_opname (GT_EXPR)); }
3945 | operator EQCOMPARE unoperator
3946 { $$ = frob_opname (ansi_opname ($2)); }
3947 | operator ASSIGN unoperator
3948 { $$ = frob_opname (ansi_assopname ($2)); }
3949 | operator '=' unoperator
3950 { $$ = frob_opname (ansi_assopname (NOP_EXPR)); }
3951 | operator LSHIFT unoperator
3952 { $$ = frob_opname (ansi_opname ($2)); }
3953 | operator RSHIFT unoperator
3954 { $$ = frob_opname (ansi_opname ($2)); }
3955 | operator PLUSPLUS unoperator
3956 { $$ = frob_opname (ansi_opname (POSTINCREMENT_EXPR)); }
3957 | operator MINUSMINUS unoperator
3958 { $$ = frob_opname (ansi_opname (PREDECREMENT_EXPR)); }
3959 | operator ANDAND unoperator
3960 { $$ = frob_opname (ansi_opname (TRUTH_ANDIF_EXPR)); }
3961 | operator OROR unoperator
3962 { $$ = frob_opname (ansi_opname (TRUTH_ORIF_EXPR)); }
3963 | operator '!' unoperator
3964 { $$ = frob_opname (ansi_opname (TRUTH_NOT_EXPR)); }
3965 | operator '?' ':' unoperator
3966 { $$ = frob_opname (ansi_opname (COND_EXPR)); }
3967 | operator MIN_MAX unoperator
3968 { $$ = frob_opname (ansi_opname ($2)); }
3969 | operator POINTSAT unoperator %prec EMPTY
3970 { $$ = frob_opname (ansi_opname (COMPONENT_REF)); }
3971 | operator POINTSAT_STAR unoperator %prec EMPTY
3972 { $$ = frob_opname (ansi_opname (MEMBER_REF)); }
3973 | operator LEFT_RIGHT unoperator
3974 { $$ = frob_opname (ansi_opname (CALL_EXPR)); }
3975 | operator '[' ']' unoperator
3976 { $$ = frob_opname (ansi_opname (ARRAY_REF)); }
3977 | operator NEW unoperator %prec EMPTY
3978 { $$ = frob_opname (ansi_opname (NEW_EXPR)); }
3979 | operator DELETE unoperator %prec EMPTY
3980 { $$ = frob_opname (ansi_opname (DELETE_EXPR)); }
3981 | operator NEW '[' ']' unoperator
3982 { $$ = frob_opname (ansi_opname (VEC_NEW_EXPR)); }
3983 | operator DELETE '[' ']' unoperator
3984 { $$ = frob_opname (ansi_opname (VEC_DELETE_EXPR)); }
3985 | operator type_specifier_seq conversion_declarator unoperator
3986 { $$ = frob_opname (grokoptypename ($2.t, $3)); }
3987 | operator error unoperator
3988 { $$ = frob_opname (ansi_opname (ERROR_MARK)); }
3991 /* The forced readahead in here is because we might be at the end of a
3992 line, and lineno won't be bumped until yylex absorbs the first token
3993 on the next line. */
3994 save_lineno:
3995 { if (yychar == YYEMPTY)
3996 yychar = YYLEX;
3997 $$ = lineno; }
4001 #ifdef SPEW_DEBUG
4002 const char *
4003 debug_yytranslate (value)
4004 int value;
4006 return yytname[YYTRANSLATE (value)];
4009 #endif