PR c++/7176
[official-gcc.git] / gcc / cp / parse.y
blob6dadc32d494eb88f9b237304538d15ea9cb4ed8e
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 TYPENAME
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 TYPENAME 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 TYPENAME 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 { $$ = 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 { $$ = 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 { $$ = 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 { $$ = 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 | TYPENAME
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
1034 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
1035 declarator
1036 { tree specs = strip_attrs ($4.t);
1037 do_decl_instantiation (specs, $5, $1); }
1038 end_explicit_instantiation
1039 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
1040 { do_decl_instantiation (NULL_TREE, $4, $1); }
1041 end_explicit_instantiation
1042 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
1043 { do_decl_instantiation (NULL_TREE, $4, $1); }
1044 end_explicit_instantiation
1047 begin_explicit_instantiation:
1048 { begin_explicit_instantiation(); }
1051 end_explicit_instantiation:
1052 { end_explicit_instantiation(); }
1055 /* The TYPENAME expansions are to deal with use of a template class name as
1056 a template within the class itself, where the template decl is hidden by
1057 a type decl. Got all that? */
1059 template_type:
1060 PTYPENAME '<' template_arg_list_opt template_close_bracket
1061 .finish_template_type
1062 { $$ = $5; }
1063 | TYPENAME '<' template_arg_list_opt template_close_bracket
1064 .finish_template_type
1065 { $$ = $5; }
1066 | self_template_type
1069 apparent_template_type:
1070 template_type
1071 | identifier '<' template_arg_list_opt '>'
1072 .finish_template_type
1073 { $$ = $5; }
1076 self_template_type:
1077 SELFNAME '<' template_arg_list_opt template_close_bracket
1078 .finish_template_type
1079 { $$ = $5; }
1082 .finish_template_type:
1084 if (yychar == YYEMPTY)
1085 yychar = YYLEX;
1087 $$ = finish_template_type ($<ttype>-3, $<ttype>-1,
1088 yychar == SCOPE);
1092 template_close_bracket:
1094 | RSHIFT
1096 /* Handle `Class<Class<Type>>' without space in the `>>' */
1097 pedwarn ("`>>' should be `> >' in template class name");
1098 yyungetc ('>', 1);
1102 template_arg_list_opt:
1103 /* empty */
1104 { $$ = NULL_TREE; }
1105 | template_arg_list
1108 template_arg_list:
1109 template_arg
1110 { $$ = build_tree_list (NULL_TREE, $$); }
1111 | template_arg_list ',' template_arg
1112 { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
1115 template_arg:
1116 type_id
1117 { $$ = groktypename ($1.t); }
1118 | PTYPENAME
1120 $$ = lastiddecl;
1121 if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
1122 $$ = TREE_TYPE ($$);
1124 | global_scope PTYPENAME
1126 $$ = lastiddecl;
1127 if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$))
1128 $$ = TREE_TYPE ($$);
1130 | expr_no_comma_rangle
1131 | nested_name_specifier TEMPLATE identifier
1133 if (!processing_template_decl)
1135 error ("use of template qualifier outside template");
1136 $$ = error_mark_node;
1138 else
1139 $$ = make_unbound_class_template ($1, $3, 1);
1143 unop:
1145 { $$ = NEGATE_EXPR; }
1146 | '+'
1147 { $$ = CONVERT_EXPR; }
1148 | PLUSPLUS
1149 { $$ = PREINCREMENT_EXPR; }
1150 | MINUSMINUS
1151 { $$ = PREDECREMENT_EXPR; }
1152 | '!'
1153 { $$ = TRUTH_NOT_EXPR; }
1156 expr:
1157 nontrivial_exprlist
1158 { $$ = build_x_compound_expr ($$); }
1159 | expr_no_commas
1162 paren_expr_or_null:
1163 LEFT_RIGHT
1164 { error ("ISO C++ forbids an empty condition for `%s'",
1165 cond_stmt_keyword);
1166 $$ = integer_zero_node; }
1167 | '(' expr ')'
1168 { $$ = $2; }
1171 paren_cond_or_null:
1172 LEFT_RIGHT
1173 { error ("ISO C++ forbids an empty condition for `%s'",
1174 cond_stmt_keyword);
1175 $$ = integer_zero_node; }
1176 | '(' condition ')'
1177 { $$ = $2; }
1180 xcond:
1181 /* empty */
1182 { $$ = NULL_TREE; }
1183 | condition
1184 | error
1185 { $$ = NULL_TREE; }
1188 condition:
1189 type_specifier_seq declarator maybeasm maybe_attribute '='
1191 tree d;
1192 for (d = getdecls (); d; d = TREE_CHAIN (d))
1193 if (TREE_CODE (d) == TYPE_DECL) {
1194 tree s = TREE_TYPE (d);
1195 if (TREE_CODE (s) == RECORD_TYPE)
1196 error ("definition of class `%T' in condition", s);
1197 else if (TREE_CODE (s) == ENUMERAL_TYPE)
1198 error ("definition of enum `%T' in condition", s);
1201 current_declspecs = $1.t;
1202 $<ttype>$ = parse_decl ($<ttype>2, $4, 1);
1204 init
1206 parse_end_decl ($<ttype>6, $7, $4);
1207 $$ = convert_from_reference ($<ttype>6);
1208 if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
1209 error ("definition of array `%#D' in condition", $$);
1211 | expr
1214 compstmtend:
1216 | maybe_label_decls stmts '}'
1217 | maybe_label_decls stmts error '}'
1218 | maybe_label_decls error '}'
1221 nontrivial_exprlist:
1222 expr_no_commas ',' expr_no_commas
1223 { $$ = tree_cons (NULL_TREE, $$,
1224 build_tree_list (NULL_TREE, $3)); }
1225 | expr_no_commas ',' error
1226 { $$ = tree_cons (NULL_TREE, $$,
1227 build_tree_list (NULL_TREE, error_mark_node)); }
1228 | nontrivial_exprlist ',' expr_no_commas
1229 { chainon ($$, build_tree_list (NULL_TREE, $3)); }
1230 | nontrivial_exprlist ',' error
1231 { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
1234 nonnull_exprlist:
1235 expr_no_commas
1236 { $$ = build_tree_list (NULL_TREE, $$); }
1237 | nontrivial_exprlist
1240 unary_expr:
1241 primary %prec UNARY
1242 { $$ = $1; }
1243 /* __extension__ turns off -pedantic for following primary. */
1244 | extension cast_expr %prec UNARY
1245 { $$ = $2;
1246 pedantic = $1; }
1247 | '*' cast_expr %prec UNARY
1248 { $$ = build_x_indirect_ref ($2, "unary *"); }
1249 | '&' cast_expr %prec UNARY
1250 { $$ = build_x_unary_op (ADDR_EXPR, $2); }
1251 | '~' cast_expr
1252 { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
1253 | unop cast_expr %prec UNARY
1254 { $$ = finish_unary_op_expr ($1, $2); }
1255 /* Refer to the address of a label as a pointer. */
1256 | ANDAND identifier
1257 { $$ = finish_label_address_expr ($2); }
1258 | sizeof unary_expr %prec UNARY
1259 { $$ = finish_sizeof ($2);
1260 skip_evaluation--; }
1261 | sizeof '(' type_id ')' %prec HYPERUNARY
1262 { $$ = finish_sizeof (groktypename ($3.t));
1263 check_for_new_type ("sizeof", $3);
1264 skip_evaluation--; }
1265 | alignof unary_expr %prec UNARY
1266 { $$ = finish_alignof ($2);
1267 skip_evaluation--; }
1268 | alignof '(' type_id ')' %prec HYPERUNARY
1269 { $$ = finish_alignof (groktypename ($3.t));
1270 check_for_new_type ("alignof", $3);
1271 skip_evaluation--; }
1273 /* The %prec EMPTY's here are required by the = init initializer
1274 syntax extension; see below. */
1275 | new new_type_id %prec EMPTY
1276 { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1);
1277 check_for_new_type ("new", $2); }
1278 | new new_type_id new_initializer
1279 { $$ = build_new (NULL_TREE, $2.t, $3, $1);
1280 check_for_new_type ("new", $2); }
1281 | new new_placement new_type_id %prec EMPTY
1282 { $$ = build_new ($2, $3.t, NULL_TREE, $1);
1283 check_for_new_type ("new", $3); }
1284 | new new_placement new_type_id new_initializer
1285 { $$ = build_new ($2, $3.t, $4, $1);
1286 check_for_new_type ("new", $3); }
1287 | new '(' type_id ')'
1288 %prec EMPTY
1289 { $$ = build_new (NULL_TREE, groktypename($3.t),
1290 NULL_TREE, $1);
1291 check_for_new_type ("new", $3); }
1292 | new '(' type_id ')' new_initializer
1293 { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1);
1294 check_for_new_type ("new", $3); }
1295 | new new_placement '(' type_id ')' %prec EMPTY
1296 { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1);
1297 check_for_new_type ("new", $4); }
1298 | new new_placement '(' type_id ')' new_initializer
1299 { $$ = build_new ($2, groktypename($4.t), $6, $1);
1300 check_for_new_type ("new", $4); }
1302 | delete cast_expr %prec UNARY
1303 { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
1304 | delete '[' ']' cast_expr %prec UNARY
1305 { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
1306 if (yychar == YYEMPTY)
1307 yychar = YYLEX; }
1308 | delete '[' expr ']' cast_expr %prec UNARY
1309 { $$ = delete_sanity ($5, $3, 2, $1);
1310 if (yychar == YYEMPTY)
1311 yychar = YYLEX; }
1312 | REALPART cast_expr %prec UNARY
1313 { $$ = build_x_unary_op (REALPART_EXPR, $2); }
1314 | IMAGPART cast_expr %prec UNARY
1315 { $$ = build_x_unary_op (IMAGPART_EXPR, $2); }
1318 new_placement:
1319 '(' nonnull_exprlist ')'
1320 { $$ = $2; }
1321 | '{' nonnull_exprlist '}'
1322 { pedwarn ("old style placement syntax, use () instead");
1323 $$ = $2; }
1326 new_initializer:
1327 '(' nonnull_exprlist ')'
1328 { $$ = $2; }
1329 | LEFT_RIGHT
1330 { $$ = void_zero_node; }
1331 | '(' typespec ')'
1333 error ("`%T' is not a valid expression", $2.t);
1334 $$ = error_mark_node;
1336 /* GNU extension so people can use initializer lists. Note that
1337 this alters the meaning of `new int = 1', which was previously
1338 syntactically valid but semantically invalid.
1339 This feature is now deprecated and will be removed in a future
1340 release. */
1341 | '=' init
1343 if (pedantic)
1344 pedwarn ("ISO C++ forbids initialization of new expression with `='");
1345 cp_deprecated ("new initializer lists extension");
1346 if (TREE_CODE ($2) != TREE_LIST
1347 && TREE_CODE ($2) != CONSTRUCTOR)
1348 $$ = build_tree_list (NULL_TREE, $2);
1349 else
1350 $$ = $2;
1354 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1355 regcast_or_absdcl:
1356 '(' type_id ')' %prec EMPTY
1357 { $2.t = finish_parmlist (build_tree_list (NULL_TREE, $2.t), 0);
1358 $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE);
1359 check_for_new_type ("cast", $2); }
1360 | regcast_or_absdcl '(' type_id ')' %prec EMPTY
1361 { $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0);
1362 $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE);
1363 check_for_new_type ("cast", $3); }
1366 cast_expr:
1367 unary_expr
1368 | regcast_or_absdcl unary_expr %prec UNARY
1369 { $$ = reparse_absdcl_as_casts ($$, $2); }
1370 | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY
1372 tree init = build_nt (CONSTRUCTOR, NULL_TREE,
1373 nreverse ($3));
1374 if (pedantic)
1375 pedwarn ("ISO C++ forbids compound literals");
1376 /* Indicate that this was a C99 compound literal. */
1377 TREE_HAS_CONSTRUCTOR (init) = 1;
1379 $$ = reparse_absdcl_as_casts ($$, init);
1383 expr_no_commas:
1384 cast_expr
1385 /* Handle general members. */
1386 | expr_no_commas POINTSAT_STAR expr_no_commas
1387 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1388 | expr_no_commas DOT_STAR expr_no_commas
1389 { $$ = build_m_component_ref ($$, $3); }
1390 | expr_no_commas '+' expr_no_commas
1391 { $$ = build_x_binary_op ($2, $$, $3); }
1392 | expr_no_commas '-' expr_no_commas
1393 { $$ = build_x_binary_op ($2, $$, $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 LSHIFT expr_no_commas
1401 { $$ = build_x_binary_op ($2, $$, $3); }
1402 | expr_no_commas RSHIFT expr_no_commas
1403 { $$ = build_x_binary_op ($2, $$, $3); }
1404 | expr_no_commas ARITHCOMPARE expr_no_commas
1405 { $$ = build_x_binary_op ($2, $$, $3); }
1406 | expr_no_commas '<' expr_no_commas
1407 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1408 | expr_no_commas '>' expr_no_commas
1409 { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
1410 | expr_no_commas EQCOMPARE expr_no_commas
1411 { $$ = build_x_binary_op ($2, $$, $3); }
1412 | expr_no_commas MIN_MAX expr_no_commas
1413 { $$ = build_x_binary_op ($2, $$, $3); }
1414 | expr_no_commas '&' expr_no_commas
1415 { $$ = build_x_binary_op ($2, $$, $3); }
1416 | expr_no_commas '|' 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 ANDAND expr_no_commas
1421 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1422 | expr_no_commas OROR expr_no_commas
1423 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1424 | expr_no_commas '?' xexpr ':' expr_no_commas
1425 { $$ = build_x_conditional_expr ($$, $3, $5); }
1426 | expr_no_commas '=' expr_no_commas
1427 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1428 if ($$ != error_mark_node)
1429 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1430 | expr_no_commas ASSIGN expr_no_commas
1431 { $$ = build_x_modify_expr ($$, $2, $3); }
1432 | THROW
1433 { $$ = build_throw (NULL_TREE); }
1434 | THROW expr_no_commas
1435 { $$ = build_throw ($2); }
1438 expr_no_comma_rangle:
1439 cast_expr
1440 /* Handle general members. */
1441 | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
1442 { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
1443 | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
1444 { $$ = build_m_component_ref ($$, $3); }
1445 | expr_no_comma_rangle '+' expr_no_comma_rangle
1446 { $$ = build_x_binary_op ($2, $$, $3); }
1447 | expr_no_comma_rangle '-' expr_no_comma_rangle
1448 { $$ = build_x_binary_op ($2, $$, $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 LSHIFT expr_no_comma_rangle
1456 { $$ = build_x_binary_op ($2, $$, $3); }
1457 | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
1458 { $$ = build_x_binary_op ($2, $$, $3); }
1459 | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
1460 { $$ = build_x_binary_op ($2, $$, $3); }
1461 | expr_no_comma_rangle '<' expr_no_comma_rangle
1462 { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
1463 | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
1464 { $$ = build_x_binary_op ($2, $$, $3); }
1465 | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
1466 { $$ = build_x_binary_op ($2, $$, $3); }
1467 | expr_no_comma_rangle '&' expr_no_comma_rangle
1468 { $$ = build_x_binary_op ($2, $$, $3); }
1469 | expr_no_comma_rangle '|' 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 ANDAND expr_no_comma_rangle
1474 { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
1475 | expr_no_comma_rangle OROR expr_no_comma_rangle
1476 { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
1477 | expr_no_comma_rangle '?' xexpr ':' expr_no_comma_rangle
1478 { $$ = build_x_conditional_expr ($$, $3, $5); }
1479 | expr_no_comma_rangle '=' expr_no_comma_rangle
1480 { $$ = build_x_modify_expr ($$, NOP_EXPR, $3);
1481 if ($$ != error_mark_node)
1482 C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
1483 | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
1484 { $$ = build_x_modify_expr ($$, $2, $3); }
1485 | THROW
1486 { $$ = build_throw (NULL_TREE); }
1487 | THROW expr_no_comma_rangle
1488 { $$ = build_throw ($2); }
1491 notype_unqualified_id:
1492 '~' see_typename identifier
1493 { $$ = build_nt (BIT_NOT_EXPR, $3); }
1494 | '~' see_typename template_type
1495 { $$ = build_nt (BIT_NOT_EXPR, $3); }
1496 | template_id
1497 | operator_name
1498 | IDENTIFIER
1499 | PTYPENAME
1500 | NSNAME %prec EMPTY
1503 do_id:
1505 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1506 means that we're in an expression like S::f<int>, so
1507 don't do_identifier; we only do that for unqualified
1508 identifiers. */
1509 if (!lastiddecl || TREE_CODE (lastiddecl) != TREE_LIST)
1510 $$ = do_identifier ($<ttype>-1, 3, NULL_TREE);
1511 else
1512 $$ = $<ttype>-1;
1516 template_id:
1517 PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket
1518 { $$ = lookup_template_function ($3, $4); }
1519 | operator_name '<' do_id template_arg_list_opt template_close_bracket
1520 { $$ = lookup_template_function ($3, $4); }
1523 object_template_id:
1524 TEMPLATE identifier '<' template_arg_list_opt template_close_bracket
1525 { $$ = lookup_template_function ($2, $4); }
1526 | TEMPLATE PFUNCNAME '<' template_arg_list_opt template_close_bracket
1527 { $$ = lookup_template_function ($2, $4); }
1528 | TEMPLATE operator_name '<' template_arg_list_opt
1529 template_close_bracket
1530 { $$ = lookup_template_function ($2, $4); }
1533 unqualified_id:
1534 notype_unqualified_id
1535 | TYPENAME
1536 | SELFNAME
1539 expr_or_declarator_intern:
1540 expr_or_declarator
1541 | attributes expr_or_declarator
1543 /* Provide support for '(' attributes '*' declarator ')'
1544 etc */
1545 $$ = tree_cons ($1, $2, NULL_TREE);
1549 expr_or_declarator:
1550 notype_unqualified_id
1551 | '*' expr_or_declarator_intern %prec UNARY
1552 { $$ = build_nt (INDIRECT_REF, $2); }
1553 | '&' expr_or_declarator_intern %prec UNARY
1554 { $$ = build_nt (ADDR_EXPR, $2); }
1555 | '(' expr_or_declarator_intern ')'
1556 { $$ = $2; }
1559 notype_template_declarator:
1560 IDENTIFIER '<' template_arg_list_opt template_close_bracket
1561 { $$ = lookup_template_function ($1, $3); }
1562 | NSNAME '<' template_arg_list template_close_bracket
1563 { $$ = lookup_template_function ($1, $3); }
1566 direct_notype_declarator:
1567 complex_direct_notype_declarator
1568 /* This precedence declaration is to prefer this reduce
1569 to the Koenig lookup shift in primary, below. I hate yacc. */
1570 | notype_unqualified_id %prec '('
1571 | notype_template_declarator
1572 | '(' expr_or_declarator_intern ')'
1573 { $$ = finish_decl_parsing ($2); }
1576 primary:
1577 notype_unqualified_id
1579 if (TREE_CODE ($1) == BIT_NOT_EXPR)
1580 $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($1, 0));
1581 else
1582 $$ = finish_id_expr ($1);
1584 | CONSTANT
1585 | boolean.literal
1586 | string
1588 $$ = combine_strings ($$);
1589 /* combine_strings doesn't set up TYPE_MAIN_VARIANT of
1590 a const array the way we want, so fix it. */
1591 if (flag_const_strings)
1592 TREE_TYPE ($$) = build_cplus_array_type
1593 (TREE_TYPE (TREE_TYPE ($$)),
1594 TYPE_DOMAIN (TREE_TYPE ($$)));
1596 | VAR_FUNC_NAME
1598 $$ = fname_decl (C_RID_CODE ($$), $$);
1599 if (processing_template_decl)
1600 $$ = build_min_nt (LOOKUP_EXPR, DECL_NAME ($$));
1602 | '(' expr ')'
1603 { $$ = finish_parenthesized_expr ($2); }
1604 | '(' expr_or_declarator_intern ')'
1605 { $2 = reparse_decl_as_expr (NULL_TREE, $2);
1606 $$ = finish_parenthesized_expr ($2); }
1607 | '(' error ')'
1608 { $$ = error_mark_node; }
1609 | '('
1610 { tree scope = current_scope ();
1611 if (!scope || TREE_CODE (scope) != FUNCTION_DECL)
1613 error ("braced-group within expression allowed only inside a function");
1614 YYERROR;
1616 if (pedantic)
1617 pedwarn ("ISO C++ forbids braced-groups within expressions");
1618 $<ttype>$ = begin_stmt_expr ();
1620 compstmt_or_stmtexpr ')'
1621 { $$ = finish_stmt_expr ($<ttype>2); }
1622 /* Koenig lookup support
1623 We could store lastiddecl in $1 to avoid another lookup,
1624 but that would result in many additional reduce/reduce conflicts. */
1625 | notype_unqualified_id '(' nonnull_exprlist ')'
1626 { $$ = finish_call_expr ($1, $3, 1); }
1627 | notype_unqualified_id LEFT_RIGHT
1628 { $$ = finish_call_expr ($1, NULL_TREE, 1); }
1629 | primary '(' nonnull_exprlist ')'
1630 { $$ = finish_call_expr ($1, $3, 0); }
1631 | primary LEFT_RIGHT
1632 { $$ = finish_call_expr ($1, NULL_TREE, 0); }
1633 | VA_ARG '(' expr_no_commas ',' type_id ')'
1634 { $$ = build_x_va_arg ($3, groktypename ($5.t));
1635 check_for_new_type ("__builtin_va_arg", $5); }
1636 | primary '[' expr ']'
1637 { $$ = grok_array_decl ($$, $3); }
1638 | primary PLUSPLUS
1639 { $$ = finish_increment_expr ($1, POSTINCREMENT_EXPR); }
1640 | primary MINUSMINUS
1641 { $$ = finish_increment_expr ($1, POSTDECREMENT_EXPR); }
1642 /* C++ extensions */
1643 | THIS
1644 { $$ = finish_this_expr (); }
1645 | CV_QUALIFIER '(' nonnull_exprlist ')'
1647 /* This is a C cast in C++'s `functional' notation
1648 using the "implicit int" extension so that:
1649 `const (3)' is equivalent to `const int (3)'. */
1650 tree type;
1652 type = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1653 type = groktypename (build_tree_list (type, NULL_TREE));
1654 $$ = build_functional_cast (type, $3);
1656 | functional_cast
1657 | DYNAMIC_CAST '<' type_id '>' '(' expr ')'
1658 { tree type = groktypename ($3.t);
1659 check_for_new_type ("dynamic_cast", $3);
1660 $$ = build_dynamic_cast (type, $6); }
1661 | STATIC_CAST '<' type_id '>' '(' expr ')'
1662 { tree type = groktypename ($3.t);
1663 check_for_new_type ("static_cast", $3);
1664 $$ = build_static_cast (type, $6); }
1665 | REINTERPRET_CAST '<' type_id '>' '(' expr ')'
1666 { tree type = groktypename ($3.t);
1667 check_for_new_type ("reinterpret_cast", $3);
1668 $$ = build_reinterpret_cast (type, $6); }
1669 | CONST_CAST '<' type_id '>' '(' expr ')'
1670 { tree type = groktypename ($3.t);
1671 check_for_new_type ("const_cast", $3);
1672 $$ = build_const_cast (type, $6); }
1673 | TYPEID '(' expr ')'
1674 { $$ = build_typeid ($3); }
1675 | TYPEID '(' type_id ')'
1676 { tree type = groktypename ($3.t);
1677 check_for_new_type ("typeid", $3);
1678 $$ = get_typeid (type); }
1679 | global_scope IDENTIFIER
1680 { $$ = do_scoped_id ($2, 1); }
1681 | global_scope template_id
1682 { $$ = $2; }
1683 | global_scope operator_name
1685 got_scope = NULL_TREE;
1686 if (TREE_CODE ($2) == IDENTIFIER_NODE)
1687 $$ = do_scoped_id ($2, 1);
1688 else
1689 $$ = $2;
1691 | overqualified_id %prec HYPERUNARY
1692 { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
1693 | overqualified_id '(' nonnull_exprlist ')'
1694 { $$ = finish_qualified_call_expr ($1, $3); }
1695 | overqualified_id LEFT_RIGHT
1696 { $$ = finish_qualified_call_expr ($1, NULL_TREE); }
1697 | object object_template_id %prec UNARY
1699 $$ = build_x_component_ref ($$, $2, NULL_TREE, 1);
1701 | object object_template_id '(' nonnull_exprlist ')'
1702 { $$ = finish_object_call_expr ($2, $1, $4); }
1703 | object object_template_id LEFT_RIGHT
1704 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1705 | object unqualified_id %prec UNARY
1706 { $$ = build_x_component_ref ($$, $2, NULL_TREE, 1); }
1707 | object overqualified_id %prec UNARY
1708 { if (processing_template_decl)
1709 $$ = build_min_nt (COMPONENT_REF, $1, $2);
1710 else
1711 $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
1712 | object unqualified_id '(' nonnull_exprlist ')'
1713 { $$ = finish_object_call_expr ($2, $1, $4); }
1714 | object unqualified_id LEFT_RIGHT
1715 { $$ = finish_object_call_expr ($2, $1, NULL_TREE); }
1716 | object overqualified_id '(' nonnull_exprlist ')'
1717 { $$ = finish_qualified_object_call_expr ($2, $1, $4); }
1718 | object overqualified_id LEFT_RIGHT
1719 { $$ = finish_qualified_object_call_expr ($2, $1, NULL_TREE); }
1720 /* p->int::~int() is valid -- 12.4 */
1721 | object '~' TYPESPEC LEFT_RIGHT
1722 { $$ = finish_pseudo_destructor_call_expr ($1, NULL_TREE, $3); }
1723 | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
1724 { $$ = finish_pseudo_destructor_call_expr ($1, $2, $5); }
1725 | object error
1727 $$ = error_mark_node;
1731 /* Not needed for now.
1733 primary_no_id:
1734 '(' expr ')'
1735 { $$ = $2; }
1736 | '(' error ')'
1737 { $$ = error_mark_node; }
1738 | '('
1739 { if (current_function_decl == 0)
1741 error ("braced-group within expression allowed only inside a function");
1742 YYERROR;
1744 $<ttype>$ = expand_start_stmt_expr (); }
1745 compstmt_or_stmtexpr ')'
1746 { if (pedantic)
1747 pedwarn ("ISO C++ forbids braced-groups within expressions");
1748 $$ = expand_end_stmt_expr ($<ttype>2); }
1749 | primary_no_id '(' nonnull_exprlist ')'
1750 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1751 | primary_no_id LEFT_RIGHT
1752 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1753 | primary_no_id '[' expr ']'
1754 { goto do_array; }
1755 | primary_no_id PLUSPLUS
1756 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1757 | primary_no_id MINUSMINUS
1758 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1759 | SCOPE IDENTIFIER
1760 { goto do_scoped_id; }
1761 | SCOPE operator_name
1762 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1763 goto do_scoped_id;
1764 goto do_scoped_operator;
1769 new:
1771 { $$ = 0; }
1772 | global_scope NEW
1773 { got_scope = NULL_TREE; $$ = 1; }
1776 delete:
1777 DELETE
1778 { $$ = 0; }
1779 | global_scope delete
1780 { got_scope = NULL_TREE; $$ = 1; }
1783 boolean.literal:
1784 CXX_TRUE
1785 { $$ = boolean_true_node; }
1786 | CXX_FALSE
1787 { $$ = boolean_false_node; }
1790 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1791 string:
1792 STRING
1793 | string STRING
1794 { $$ = chainon ($$, $2); }
1797 nodecls:
1798 /* empty */
1800 if (DECL_CONSTRUCTOR_P (current_function_decl))
1801 finish_mem_initializers (NULL_TREE);
1805 object:
1806 primary '.'
1807 { got_object = TREE_TYPE ($$); }
1808 | primary POINTSAT
1810 $$ = build_x_arrow ($$);
1811 got_object = TREE_TYPE ($$);
1815 decl:
1816 typespec initdecls ';'
1818 if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t)))
1819 note_got_semicolon ($1.t);
1821 | typed_declspecs initdecls ';'
1823 note_list_got_semicolon ($1.t);
1825 | declmods notype_initdecls ';'
1827 | typed_declspecs ';'
1829 shadow_tag ($1.t);
1830 note_list_got_semicolon ($1.t);
1832 | declmods ';'
1833 { warning ("empty declaration"); }
1834 | extension decl
1835 { pedantic = $1; }
1838 /* Any kind of declarator (thus, all declarators allowed
1839 after an explicit typespec). */
1841 declarator:
1842 after_type_declarator %prec EMPTY
1843 | notype_declarator %prec EMPTY
1846 /* This is necessary to postpone reduction of `int()()()()'. */
1847 fcast_or_absdcl:
1848 LEFT_RIGHT %prec EMPTY
1849 { $$ = make_call_declarator (NULL_TREE, empty_parms (),
1850 NULL_TREE, NULL_TREE); }
1851 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1852 { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE,
1853 NULL_TREE); }
1856 /* ISO type-id (8.1) */
1857 type_id:
1858 typed_typespecs absdcl
1859 { $$.t = build_tree_list ($1.t, $2);
1860 $$.new_type_flag = $1.new_type_flag; }
1861 | nonempty_cv_qualifiers absdcl
1862 { $$.t = build_tree_list ($1.t, $2);
1863 $$.new_type_flag = $1.new_type_flag; }
1864 | typespec absdcl
1865 { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
1866 $2);
1867 $$.new_type_flag = $1.new_type_flag; }
1868 | typed_typespecs %prec EMPTY
1869 { $$.t = build_tree_list ($1.t, NULL_TREE);
1870 $$.new_type_flag = $1.new_type_flag; }
1871 | nonempty_cv_qualifiers %prec EMPTY
1872 { $$.t = build_tree_list ($1.t, NULL_TREE);
1873 $$.new_type_flag = $1.new_type_flag; }
1876 /* Declspecs which contain at least one type specifier or typedef name.
1877 (Just `const' or `volatile' is not enough.)
1878 A typedef'd name following these is taken as a name to be declared.
1879 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1881 typed_declspecs:
1882 typed_typespecs %prec EMPTY
1883 { $$.lookups = type_lookups; }
1884 | typed_declspecs1
1885 { $$.lookups = type_lookups; }
1888 typed_declspecs1:
1889 declmods typespec
1890 { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
1891 $$.new_type_flag = $2.new_type_flag; }
1892 | typespec reserved_declspecs %prec HYPERUNARY
1893 { $$.t = tree_cons (NULL_TREE, $1.t, $2);
1894 $$.new_type_flag = $1.new_type_flag; }
1895 | typespec reserved_typespecquals reserved_declspecs
1896 { $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3));
1897 $$.new_type_flag = $1.new_type_flag; }
1898 | declmods typespec reserved_declspecs
1899 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1900 $$.new_type_flag = $2.new_type_flag; }
1901 | declmods typespec reserved_typespecquals
1902 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1903 $$.new_type_flag = $2.new_type_flag; }
1904 | declmods typespec reserved_typespecquals reserved_declspecs
1905 { $$.t = tree_cons (NULL_TREE, $2.t,
1906 chainon ($3, chainon ($4, $1.t)));
1907 $$.new_type_flag = $2.new_type_flag; }
1910 reserved_declspecs:
1911 SCSPEC
1912 { if (extra_warnings)
1913 warning ("`%s' is not at beginning of declaration",
1914 IDENTIFIER_POINTER ($$));
1915 $$ = build_tree_list (NULL_TREE, $$); }
1916 | reserved_declspecs typespecqual_reserved
1917 { $$ = tree_cons (NULL_TREE, $2.t, $$); }
1918 | reserved_declspecs SCSPEC
1919 { if (extra_warnings)
1920 warning ("`%s' is not at beginning of declaration",
1921 IDENTIFIER_POINTER ($2));
1922 $$ = tree_cons (NULL_TREE, $2, $$); }
1925 /* List of just storage classes and type modifiers.
1926 A declaration can start with just this, but then it cannot be used
1927 to redeclare a typedef-name.
1928 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1930 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1931 up on a persistent obstack. Otherwise, they could appear at the
1932 beginning of something like
1934 static const struct { int foo () { } } b;
1936 and would be discarded after we finish compiling foo. We don't need to
1937 worry once we see a type. */
1939 declmods:
1940 nonempty_cv_qualifiers %prec EMPTY
1941 { $$.lookups = NULL_TREE; TREE_STATIC ($$.t) = 1; }
1942 | SCSPEC
1944 $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
1945 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
1947 | declmods CV_QUALIFIER
1949 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1950 TREE_STATIC ($$.t) = 1;
1952 | declmods SCSPEC
1954 if (extra_warnings && TREE_STATIC ($$.t))
1955 warning ("`%s' is not at beginning of declaration",
1956 IDENTIFIER_POINTER ($2));
1957 $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
1958 TREE_STATIC ($$.t) = TREE_STATIC ($1.t);
1960 | declmods attributes
1961 { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t); }
1964 /* Used instead of declspecs where storage classes are not allowed
1965 (that is, for typenames and structure components).
1967 C++ can takes storage classes for structure components.
1968 Don't accept a typedef-name if anything but a modifier precedes it. */
1970 typed_typespecs:
1971 typespec %prec EMPTY
1972 { $$.t = build_tree_list (NULL_TREE, $1.t);
1973 $$.new_type_flag = $1.new_type_flag; }
1974 | nonempty_cv_qualifiers typespec
1975 { $$.t = tree_cons (NULL_TREE, $2.t, $1.t);
1976 $$.new_type_flag = $2.new_type_flag; }
1977 | typespec reserved_typespecquals
1978 { $$.t = tree_cons (NULL_TREE, $1.t, $2);
1979 $$.new_type_flag = $1.new_type_flag; }
1980 | nonempty_cv_qualifiers typespec reserved_typespecquals
1981 { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t));
1982 $$.new_type_flag = $2.new_type_flag; }
1985 reserved_typespecquals:
1986 typespecqual_reserved
1987 { $$ = build_tree_list (NULL_TREE, $1.t); }
1988 | reserved_typespecquals typespecqual_reserved
1989 { $$ = tree_cons (NULL_TREE, $2.t, $1); }
1990 | reserved_typespecquals attributes
1991 { $$ = tree_cons ($2, NULL_TREE, $1); }
1992 | attributes %prec EMPTY
1993 { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
1996 sizeof:
1997 SIZEOF { skip_evaluation++; }
2000 alignof:
2001 ALIGNOF { skip_evaluation++; }
2004 typeof:
2005 TYPEOF { skip_evaluation++; }
2008 /* A typespec (but not a type qualifier).
2009 Once we have seen one of these in a declaration,
2010 if a typedef name appears then it is being redeclared. */
2012 typespec:
2013 structsp
2014 { $$.lookups = NULL_TREE; }
2015 | TYPESPEC %prec EMPTY
2016 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
2017 | complete_type_name
2018 { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
2019 | typeof '(' expr ')'
2020 { $$.t = finish_typeof ($3);
2021 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2022 skip_evaluation--; }
2023 | typeof '(' type_id ')'
2024 { $$.t = groktypename ($3.t);
2025 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2026 skip_evaluation--; }
2027 | SIGOF '(' expr ')'
2028 { tree type = TREE_TYPE ($3);
2030 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2031 if (IS_AGGR_TYPE (type))
2033 sorry ("sigof type specifier");
2034 $$.t = type;
2036 else
2038 error ("`sigof' applied to non-aggregate expression");
2039 $$.t = error_mark_node;
2042 | SIGOF '(' type_id ')'
2043 { tree type = groktypename ($3.t);
2045 $$.new_type_flag = 0; $$.lookups = NULL_TREE;
2046 if (IS_AGGR_TYPE (type))
2048 sorry ("sigof type specifier");
2049 $$.t = type;
2051 else
2053 error("`sigof' applied to non-aggregate type");
2054 $$.t = error_mark_node;
2059 /* A typespec that is a reserved word, or a type qualifier. */
2061 typespecqual_reserved:
2062 TYPESPEC
2063 { $$.t = $1; $$.new_type_flag = 0; }
2064 | CV_QUALIFIER
2065 { $$.t = $1; $$.new_type_flag = 0; }
2066 | structsp
2069 initdecls:
2070 initdcl0
2071 | initdecls ',' initdcl
2072 { check_multiple_declarators (); }
2075 notype_initdecls:
2076 notype_initdcl0
2077 | notype_initdecls ',' initdcl
2078 { check_multiple_declarators (); }
2081 nomods_initdecls:
2082 nomods_initdcl0
2083 | nomods_initdecls ',' initdcl
2084 { check_multiple_declarators (); }
2087 maybeasm:
2088 /* empty */
2089 { $$ = NULL_TREE; }
2090 | asm_keyword '(' string ')'
2091 { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
2094 initdcl:
2095 declarator maybeasm maybe_attribute '='
2096 { $<ttype>$ = parse_decl ($<ttype>1, $3, 1); }
2097 init
2098 /* Note how the declaration of the variable is in effect while its init is parsed! */
2099 { parse_end_decl ($<ttype>5, $6, $2); }
2100 | declarator maybeasm maybe_attribute
2102 $<ttype>$ = parse_decl ($<ttype>1, $3, 0);
2103 parse_end_decl ($<ttype>$, NULL_TREE, $2);
2107 /* This rule assumes a certain configuration of the parser stack.
2108 In particular, $0, the element directly before the beginning of
2109 this rule on the stack, must be a maybeasm. $-1 must be a
2110 declarator or notype_declarator. And $-2 must be some declmods
2111 or declspecs. We can't move the maybeasm into this rule because
2112 we need that reduce so we prefer fn.def1 when appropriate. */
2113 initdcl0_innards:
2114 maybe_attribute '='
2115 { $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
2116 $<ftype>-2.lookups, $1, 1); }
2117 /* Note how the declaration of the variable is in effect
2118 while its init is parsed! */
2119 init
2120 { parse_end_decl ($<ttype>3, $4, $<ttype>0); }
2121 | maybe_attribute
2122 { tree d = parse_decl0 ($<ttype>-1, $<ftype>-2.t,
2123 $<ftype>-2.lookups, $1, 0);
2124 parse_end_decl (d, NULL_TREE, $<ttype>0); }
2127 initdcl0:
2128 declarator maybeasm initdcl0_innards
2132 notype_initdcl0:
2133 notype_declarator maybeasm initdcl0_innards
2137 nomods_initdcl0:
2138 notype_declarator maybeasm
2139 { /* Set things up as initdcl0_innards expects. */
2140 $<ttype>$ = $2;
2141 $2 = $1;
2142 $<ftype>1.t = NULL_TREE;
2143 $<ftype>1.lookups = NULL_TREE; }
2144 initdcl0_innards
2146 | constructor_declarator maybeasm maybe_attribute
2147 { tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0);
2148 parse_end_decl (d, NULL_TREE, $2); }
2151 /* the * rules are dummies to accept the Apollo extended syntax
2152 so that the header files compile. */
2153 maybe_attribute:
2154 /* empty */
2155 { $$ = NULL_TREE; }
2156 | attributes
2157 { $$ = $1; }
2160 attributes:
2161 attribute
2162 { $$ = $1; }
2163 | attributes attribute
2164 { $$ = chainon ($1, $2); }
2167 attribute:
2168 ATTRIBUTE '(' '(' attribute_list ')' ')'
2169 { $$ = $4; }
2172 attribute_list:
2173 attrib
2174 { $$ = $1; }
2175 | attribute_list ',' attrib
2176 { $$ = chainon ($1, $3); }
2179 attrib:
2180 /* empty */
2181 { $$ = NULL_TREE; }
2182 | any_word
2183 { $$ = build_tree_list ($1, NULL_TREE); }
2184 | any_word '(' IDENTIFIER ')'
2185 { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
2186 | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
2187 { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
2188 | any_word '(' nonnull_exprlist ')'
2189 { $$ = build_tree_list ($1, $3); }
2192 /* This still leaves out most reserved keywords,
2193 shouldn't we include them? */
2195 any_word:
2196 identifier
2197 | SCSPEC
2198 | TYPESPEC
2199 | CV_QUALIFIER
2202 /* A nonempty list of identifiers, including typenames. */
2203 identifiers_or_typenames:
2204 identifier
2205 { $$ = build_tree_list (NULL_TREE, $1); }
2206 | identifiers_or_typenames ',' identifier
2207 { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
2210 maybe_init:
2211 /* empty */ %prec EMPTY
2212 { $$ = NULL_TREE; }
2213 | '=' init
2214 { $$ = $2; }
2217 /* If we are processing a template, we don't want to expand this
2218 initializer yet. */
2220 init:
2221 expr_no_commas %prec '='
2222 | '{' '}'
2223 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
2224 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2225 | '{' initlist '}'
2226 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2227 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2228 | '{' initlist ',' '}'
2229 { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
2230 TREE_HAS_CONSTRUCTOR ($$) = 1; }
2231 | error
2232 { $$ = NULL_TREE; }
2235 /* This chain is built in reverse order,
2236 and put in forward order where initlist is used. */
2237 initlist:
2238 init
2239 { $$ = build_tree_list (NULL_TREE, $$); }
2240 | initlist ',' init
2241 { $$ = tree_cons (NULL_TREE, $3, $$); }
2242 /* These are for labeled elements. */
2243 | '[' expr_no_commas ']' init
2244 { $$ = build_tree_list ($2, $4); }
2245 | identifier ':' init
2246 { $$ = build_tree_list ($$, $3); }
2247 | initlist ',' identifier ':' init
2248 { $$ = tree_cons ($3, $5, $$); }
2251 pending_inline:
2252 PRE_PARSED_FUNCTION_DECL maybe_return_init function_body
2254 expand_body (finish_function (2));
2255 process_next_inline ($1);
2257 | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
2259 expand_body (finish_function (2));
2260 process_next_inline ($1);
2262 | PRE_PARSED_FUNCTION_DECL maybe_return_init error
2264 finish_function (2);
2265 process_next_inline ($1); }
2268 pending_inlines:
2269 /* empty */
2270 | pending_inlines pending_inline eat_saved_input
2273 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2274 the TREE_LIST node for the parameter in question. */
2275 defarg_again:
2276 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2277 { replace_defarg ($1, $2); }
2278 | DEFARG_MARKER error END_OF_SAVED_INPUT
2279 { replace_defarg ($1, error_mark_node); }
2282 pending_defargs:
2283 /* empty */ %prec EMPTY
2284 | pending_defargs defarg_again
2285 { do_pending_defargs (); }
2286 | pending_defargs error
2287 { do_pending_defargs (); }
2290 structsp:
2291 ENUM identifier '{'
2292 { $<ttype>$ = current_enum_type;
2293 current_enum_type = start_enum ($2); }
2294 enumlist_opt '}'
2295 { $$.t = current_enum_type;
2296 finish_enum (current_enum_type);
2297 $$.new_type_flag = 1;
2298 current_enum_type = $<ttype>4;
2299 check_for_missing_semicolon ($$.t); }
2300 | ENUM '{'
2301 { $<ttype>$ = current_enum_type;
2302 current_enum_type = start_enum (make_anon_name ()); }
2303 enumlist_opt '}'
2304 { $$.t = current_enum_type;
2305 finish_enum (current_enum_type);
2306 $$.new_type_flag = 1;
2307 current_enum_type = $<ttype>3;
2308 check_for_missing_semicolon ($$.t); }
2309 | ENUM identifier
2310 { $$.t = xref_tag (enum_type_node, $2, 1);
2311 $$.new_type_flag = 0; }
2312 | ENUM complex_type_name
2313 { $$.t = xref_tag (enum_type_node, $2, 1);
2314 $$.new_type_flag = 0; }
2315 | TYPENAME_KEYWORD typename_sub
2316 { $$.t = $2;
2317 $$.new_type_flag = 0;
2318 if (!processing_template_decl)
2319 pedwarn ("using `typename' outside of template"); }
2320 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2321 | class_head_defn maybe_base_class_list '{'
2323 if ($2 && $1.t != error_mark_node)
2325 tree type = TREE_TYPE ($1.t);
2327 if (TREE_CODE (type) == TYPENAME_TYPE)
2328 /* In a definition of a member class template,
2329 we will get here with an implicit typename,
2330 a TYPENAME_TYPE with a type. */
2331 type = TREE_TYPE (type);
2332 maybe_process_partial_specialization (type);
2333 xref_basetypes (current_aggr, $1.t, type, $2);
2335 $1.t = begin_class_definition (TREE_TYPE ($1.t));
2336 check_class_key (current_aggr, $1.t);
2337 current_aggr = NULL_TREE; }
2338 opt.component_decl_list '}' maybe_attribute
2340 int semi;
2341 tree t;
2343 if (yychar == YYEMPTY)
2344 yychar = YYLEX;
2345 semi = yychar == ';';
2347 t = finish_class_definition ($1.t, $7, semi, $1.new_type_flag);
2348 $<ttype>$ = t;
2350 /* restore current_aggr */
2351 current_aggr = TREE_CODE (t) != RECORD_TYPE
2352 ? union_type_node
2353 : CLASSTYPE_DECLARED_CLASS (t)
2354 ? class_type_node : record_type_node;
2356 pending_defargs
2358 done_pending_defargs ();
2359 begin_inline_definitions ();
2361 pending_inlines
2363 finish_inline_definitions ();
2364 $$.t = $<ttype>8;
2365 $$.new_type_flag = 1;
2367 | class_head_decl
2369 $$.t = TREE_TYPE ($1.t);
2370 $$.new_type_flag = $1.new_type_flag;
2371 check_class_key (current_aggr, $$.t);
2375 maybecomma:
2376 /* empty */
2377 | ','
2380 maybecomma_warn:
2381 /* empty */
2382 | ','
2383 { if (pedantic && !in_system_header)
2384 pedwarn ("comma at end of enumerator list"); }
2387 aggr:
2388 AGGR
2389 | aggr SCSPEC
2390 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2391 | aggr TYPESPEC
2392 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2393 | aggr CV_QUALIFIER
2394 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
2395 | aggr AGGR
2396 { error ("no body nor ';' separates two class, struct or union declarations"); }
2397 | aggr attributes
2398 { $$ = build_tree_list ($2, $1); }
2401 class_head:
2402 aggr identifier
2404 current_aggr = $1;
2405 $$ = build_tree_list (NULL_TREE, $2);
2407 | aggr nested_name_specifier identifier
2409 current_aggr = $1;
2410 $$ = build_tree_list ($2, $3);
2412 | aggr global_scope nested_name_specifier identifier
2414 current_aggr = $1;
2415 $$ = build_tree_list ($3, $4);
2417 | aggr global_scope identifier
2419 current_aggr = $1;
2420 $$ = build_tree_list (global_namespace, $3);
2424 class_head_apparent_template:
2425 aggr apparent_template_type
2427 current_aggr = $1;
2428 $$ = $2;
2430 | aggr nested_name_specifier apparent_template_type
2432 current_aggr = $1;
2433 $$ = $3;
2435 | aggr global_scope nested_name_specifier apparent_template_type
2437 current_aggr = $1;
2438 $$ = $4;
2442 class_head_decl:
2443 class_head %prec EMPTY
2445 $$.t = handle_class_head (current_aggr,
2446 TREE_PURPOSE ($1), TREE_VALUE ($1),
2447 0, &$$.new_type_flag);
2449 | aggr identifier_defn %prec EMPTY
2451 current_aggr = $1;
2452 $$.t = TYPE_MAIN_DECL (xref_tag (current_aggr, $2, 0));
2453 $$.new_type_flag = 1;
2455 | class_head_apparent_template %prec EMPTY
2457 $$.t = $1;
2458 $$.new_type_flag = 0;
2462 class_head_defn:
2463 class_head '{'
2465 yyungetc ('{', 1);
2466 $$.t = handle_class_head (current_aggr,
2467 TREE_PURPOSE ($1), TREE_VALUE ($1),
2468 1, &$$.new_type_flag);
2470 | class_head ':'
2472 yyungetc (':', 1);
2473 $$.t = handle_class_head (current_aggr,
2474 TREE_PURPOSE ($1), TREE_VALUE ($1),
2475 1, &$$.new_type_flag);
2477 | class_head_apparent_template '{'
2479 yyungetc ('{', 1);
2480 $$.t = $1;
2481 $$.new_type_flag = 0;
2482 if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
2483 /* We might be specializing a template with a different
2484 class-key. */
2485 CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
2486 = (current_aggr == class_type_node);
2488 | class_head_apparent_template ':'
2490 yyungetc (':', 1);
2491 $$.t = $1;
2492 $$.new_type_flag = 0;
2493 if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
2494 /* We might be specializing a template with a different
2495 class-key. */
2496 CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
2497 = (current_aggr == class_type_node);
2499 | aggr identifier_defn '{'
2501 yyungetc ('{', 1);
2502 current_aggr = $1;
2503 $$.t = handle_class_head (current_aggr,
2504 NULL_TREE, $2,
2505 1, &$$.new_type_flag);
2507 | aggr identifier_defn ':'
2509 yyungetc (':', 1);
2510 current_aggr = $1;
2511 $$.t = handle_class_head (current_aggr,
2512 NULL_TREE, $2,
2513 1, &$$.new_type_flag);
2515 | aggr '{'
2517 current_aggr = $1;
2518 $$.t = TYPE_MAIN_DECL (xref_tag ($1, make_anon_name (), 0));
2519 $$.new_type_flag = 0;
2520 yyungetc ('{', 1);
2524 maybe_base_class_list:
2525 /* empty */
2526 { $$ = NULL_TREE; }
2527 | ':' see_typename
2528 { error ("no bases given following `:'");
2529 $$ = NULL_TREE; }
2530 | ':' see_typename base_class_list
2531 { $$ = $3; }
2534 base_class_list:
2535 base_class
2536 | base_class_list ',' see_typename base_class
2537 { $$ = chainon ($$, $4); }
2540 base_class:
2541 base_class.1
2542 { $$ = finish_base_specifier (access_default_node, $1); }
2543 | base_class_access_list see_typename base_class.1
2544 { $$ = finish_base_specifier ($1, $3); }
2547 base_class.1:
2548 typename_sub
2549 { if (!TYPE_P ($$))
2550 $$ = error_mark_node; }
2551 | nonnested_type
2552 { $$ = TREE_TYPE ($$); }
2555 base_class_access_list:
2556 VISSPEC see_typename
2557 | SCSPEC see_typename
2558 { if ($1 != ridpointers[(int)RID_VIRTUAL])
2559 error ("`%D' access", $1);
2560 $$ = access_default_virtual_node; }
2561 | base_class_access_list VISSPEC see_typename
2563 if ($1 != access_default_virtual_node)
2564 error ("multiple access specifiers");
2565 else if ($2 == access_public_node)
2566 $$ = access_public_virtual_node;
2567 else if ($2 == access_protected_node)
2568 $$ = access_protected_virtual_node;
2569 else /* $2 == access_private_node */
2570 $$ = access_private_virtual_node;
2572 | base_class_access_list SCSPEC see_typename
2573 { if ($2 != ridpointers[(int)RID_VIRTUAL])
2574 error ("`%D' access", $2);
2575 else if ($$ == access_public_node)
2576 $$ = access_public_virtual_node;
2577 else if ($$ == access_protected_node)
2578 $$ = access_protected_virtual_node;
2579 else if ($$ == access_private_node)
2580 $$ = access_private_virtual_node;
2581 else
2582 error ("multiple `virtual' specifiers");
2586 opt.component_decl_list:
2587 | component_decl_list
2588 | opt.component_decl_list access_specifier component_decl_list
2589 | opt.component_decl_list access_specifier
2592 access_specifier:
2593 VISSPEC ':'
2595 current_access_specifier = $1;
2599 /* Note: we no longer warn about the semicolon after a component_decl_list.
2600 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2601 component_decl_list:
2602 component_decl
2604 finish_member_declaration ($1);
2605 current_aggr = NULL_TREE;
2606 reset_type_access_control ();
2608 | component_decl_list component_decl
2610 finish_member_declaration ($2);
2611 current_aggr = NULL_TREE;
2612 reset_type_access_control ();
2616 component_decl:
2617 component_decl_1 ';'
2618 | component_decl_1 '}'
2619 { error ("missing ';' before right brace");
2620 yyungetc ('}', 0); }
2621 /* C++: handle constructors, destructors and inline functions */
2622 /* note that INLINE is like a TYPESPEC */
2623 | fn.def2 ':' /* base_init compstmt */
2624 { $$ = finish_method ($$); }
2625 | fn.def2 TRY /* base_init compstmt */
2626 { $$ = finish_method ($$); }
2627 | fn.def2 RETURN_KEYWORD /* base_init compstmt */
2628 { $$ = finish_method ($$); }
2629 | fn.def2 '{' /* nodecls compstmt */
2630 { $$ = finish_method ($$); }
2631 | ';'
2632 { $$ = NULL_TREE; }
2633 | extension component_decl
2634 { $$ = $2;
2635 pedantic = $1; }
2636 | template_header component_decl
2638 if ($2)
2639 $$ = finish_member_template_decl ($2);
2640 else
2641 /* The component was already processed. */
2642 $$ = NULL_TREE;
2644 finish_template_decl ($1);
2646 | template_header typed_declspecs ';'
2648 $$ = finish_member_class_template ($2.t);
2649 finish_template_decl ($1);
2651 | bad_decl
2652 { $$ = NULL_TREE; }
2655 component_decl_1:
2656 /* Do not add a "typed_declspecs declarator" rule here for
2657 speed; we need to call grok_x_components for enums, so the
2658 speedup would be insignificant. */
2659 typed_declspecs components
2661 /* Most of the productions for component_decl only
2662 allow the creation of one new member, so we call
2663 finish_member_declaration in component_decl_list.
2664 For this rule and the next, however, there can be
2665 more than one member, e.g.:
2667 int i, j;
2669 and we need the first member to be fully
2670 registered before the second is processed.
2671 Therefore, the rules for components take care of
2672 this processing. To avoid registering the
2673 components more than once, we send NULL_TREE up
2674 here; that lets finish_member_declaration know
2675 that there is nothing to do. */
2676 if (!$2)
2677 grok_x_components ($1.t);
2678 $$ = NULL_TREE;
2680 | declmods notype_components
2682 if (!$2)
2683 grok_x_components ($1.t);
2684 $$ = NULL_TREE;
2686 | notype_declarator maybeasm maybe_attribute maybe_init
2687 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2688 | constructor_declarator maybeasm maybe_attribute maybe_init
2689 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2690 | ':' expr_no_commas
2691 { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
2692 | error
2693 { $$ = NULL_TREE; }
2695 /* These rules introduce a reduce/reduce conflict; in
2696 typedef int foo, bar;
2697 class A {
2698 foo (bar);
2700 should "A::foo" be declared as a function or "A::bar" as a data
2701 member? In other words, is "bar" an after_type_declarator or a
2702 parmlist? */
2703 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2704 { tree specs, attrs;
2705 split_specs_attrs ($1.t, &specs, &attrs);
2706 $$ = grokfield ($2, specs, $5, $3,
2707 chainon ($4, attrs)); }
2708 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2709 { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); }
2710 | using_decl
2711 { $$ = do_class_using_decl ($1); }
2714 /* The case of exactly one component is handled directly by component_decl. */
2715 /* ??? Huh? ^^^ */
2716 components:
2717 /* empty: possibly anonymous */
2718 { $$ = 0; }
2719 | component_declarator0
2721 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2722 $1 = finish_member_template_decl ($1);
2723 finish_member_declaration ($1);
2724 $$ = 1;
2726 | components ',' component_declarator
2728 check_multiple_declarators ();
2729 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2730 $3 = finish_member_template_decl ($3);
2731 finish_member_declaration ($3);
2732 $$ = 2;
2736 notype_components:
2737 /* empty: possibly anonymous */
2738 { $$ = 0; }
2739 | notype_component_declarator0
2741 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2742 $1 = finish_member_template_decl ($1);
2743 finish_member_declaration ($1);
2744 $$ = 1;
2746 | notype_components ',' notype_component_declarator
2748 check_multiple_declarators ();
2749 if (PROCESSING_REAL_TEMPLATE_DECL_P ())
2750 $3 = finish_member_template_decl ($3);
2751 finish_member_declaration ($3);
2752 $$ = 2;
2756 component_declarator0:
2757 after_type_component_declarator0
2758 | notype_component_declarator0
2761 component_declarator:
2762 after_type_component_declarator
2763 | notype_component_declarator
2766 after_type_component_declarator0:
2767 after_type_declarator maybeasm maybe_attribute maybe_init
2768 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2769 $3, $2, $4); }
2770 | TYPENAME ':' expr_no_commas maybe_attribute
2771 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2772 $4, $3); }
2775 notype_component_declarator0:
2776 notype_declarator maybeasm maybe_attribute maybe_init
2777 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2778 $3, $2, $4); }
2779 | constructor_declarator maybeasm maybe_attribute maybe_init
2780 { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2781 $3, $2, $4); }
2782 | IDENTIFIER ':' expr_no_commas maybe_attribute
2783 { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups,
2784 $4, $3); }
2785 | ':' expr_no_commas maybe_attribute
2786 { $$ = parse_bitfield0 (NULL_TREE, $<ftype>0.t,
2787 $<ftype>0.lookups, $3, $2); }
2790 after_type_component_declarator:
2791 after_type_declarator maybeasm maybe_attribute maybe_init
2792 { $$ = parse_field ($1, $3, $2, $4); }
2793 | TYPENAME ':' expr_no_commas maybe_attribute
2794 { $$ = parse_bitfield ($1, $4, $3); }
2797 notype_component_declarator:
2798 notype_declarator maybeasm maybe_attribute maybe_init
2799 { $$ = parse_field ($1, $3, $2, $4); }
2800 | IDENTIFIER ':' expr_no_commas maybe_attribute
2801 { $$ = parse_bitfield ($1, $4, $3); }
2802 | ':' expr_no_commas maybe_attribute
2803 { $$ = parse_bitfield (NULL_TREE, $3, $2); }
2806 enumlist_opt:
2807 enumlist maybecomma_warn
2808 | maybecomma_warn
2811 /* We chain the enumerators in reverse order.
2812 Because of the way enums are built, the order is
2813 insignificant. Take advantage of this fact. */
2815 enumlist:
2816 enumerator
2817 | enumlist ',' enumerator
2820 enumerator:
2821 identifier
2822 { build_enumerator ($1, NULL_TREE, current_enum_type); }
2823 | identifier '=' expr_no_commas
2824 { build_enumerator ($1, $3, current_enum_type); }
2827 /* ISO new-type-id (5.3.4) */
2828 new_type_id:
2829 type_specifier_seq new_declarator
2830 { $$.t = build_tree_list ($1.t, $2);
2831 $$.new_type_flag = $1.new_type_flag; }
2832 | type_specifier_seq %prec EMPTY
2833 { $$.t = build_tree_list ($1.t, NULL_TREE);
2834 $$.new_type_flag = $1.new_type_flag; }
2835 /* GNU extension to allow arrays of arbitrary types with
2836 non-constant dimension. */
2837 | '(' type_id ')' '[' expr ']'
2839 if (pedantic)
2840 pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new");
2841 $$.t = build_nt (ARRAY_REF, TREE_VALUE ($2.t), $5);
2842 $$.t = build_tree_list (TREE_PURPOSE ($2.t), $$.t);
2843 $$.new_type_flag = $2.new_type_flag;
2847 cv_qualifiers:
2848 /* empty */ %prec EMPTY
2849 { $$ = NULL_TREE; }
2850 | cv_qualifiers CV_QUALIFIER
2851 { $$ = tree_cons (NULL_TREE, $2, $$); }
2854 nonempty_cv_qualifiers:
2855 CV_QUALIFIER
2856 { $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE);
2857 $$.new_type_flag = 0; }
2858 | nonempty_cv_qualifiers CV_QUALIFIER
2859 { $$.t = hash_tree_cons (NULL_TREE, $2, $1.t);
2860 $$.new_type_flag = $1.new_type_flag; }
2861 | attributes %prec EMPTY
2862 { $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE);
2863 $$.new_type_flag = 0; }
2864 | nonempty_cv_qualifiers attributes %prec EMPTY
2865 { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t);
2866 $$.new_type_flag = $1.new_type_flag; }
2869 /* These rules must follow the rules for function declarations
2870 and component declarations. That way, longer rules are preferred. */
2872 /* An expression which will not live on the momentary obstack. */
2873 maybe_parmlist:
2874 '(' nonnull_exprlist ')'
2875 { $$ = $2; }
2876 | '(' parmlist ')'
2877 { $$ = $2; }
2878 | LEFT_RIGHT
2879 { $$ = empty_parms (); }
2880 | '(' error ')'
2881 { $$ = NULL_TREE; }
2884 /* A declarator that is allowed only after an explicit typespec. */
2886 after_type_declarator_intern:
2887 after_type_declarator
2888 | attributes after_type_declarator
2890 /* Provide support for '(' attributes '*' declarator ')'
2891 etc */
2892 $$ = tree_cons ($1, $2, NULL_TREE);
2896 /* may all be followed by prec '.' */
2897 after_type_declarator:
2898 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2899 { $$ = make_pointer_declarator ($2.t, $3); }
2900 | '&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2901 { $$ = make_reference_declarator ($2.t, $3); }
2902 | '*' after_type_declarator_intern %prec UNARY
2903 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2904 | '&' after_type_declarator_intern %prec UNARY
2905 { $$ = make_reference_declarator (NULL_TREE, $2); }
2906 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2907 { tree arg = make_pointer_declarator ($2, $3);
2908 $$ = build_nt (SCOPE_REF, $1, arg);
2910 | direct_after_type_declarator
2913 direct_after_type_declarator:
2914 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
2915 { $$ = make_call_declarator ($$, $2, $3, $4); }
2916 | direct_after_type_declarator '[' expr ']'
2917 { $$ = build_nt (ARRAY_REF, $$, $3); }
2918 | direct_after_type_declarator '[' ']'
2919 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
2920 | '(' after_type_declarator_intern ')'
2921 { $$ = $2; }
2922 | nested_name_specifier type_name %prec EMPTY
2923 { push_nested_class ($1, 3);
2924 $$ = build_nt (SCOPE_REF, $$, $2);
2925 TREE_COMPLEXITY ($$) = current_class_depth; }
2926 | type_name %prec EMPTY
2929 nonnested_type:
2930 type_name %prec EMPTY
2932 if (TREE_CODE ($1) == IDENTIFIER_NODE)
2934 $$ = lookup_name ($1, 1);
2935 maybe_note_name_used_in_class ($1, $$);
2937 else
2938 $$ = $1;
2940 | global_scope type_name
2942 if (TREE_CODE ($2) == IDENTIFIER_NODE)
2943 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
2944 else
2945 $$ = $2;
2946 got_scope = NULL_TREE;
2950 complete_type_name:
2951 nonnested_type
2952 | nested_type
2953 | global_scope nested_type
2954 { $$ = $2; }
2957 nested_type:
2958 nested_name_specifier type_name %prec EMPTY
2959 { $$ = get_type_decl ($2); }
2962 /* A declarator allowed whether or not there has been
2963 an explicit typespec. These cannot redeclare a typedef-name. */
2965 notype_declarator_intern:
2966 notype_declarator
2967 | attributes notype_declarator
2969 /* Provide support for '(' attributes '*' declarator ')'
2970 etc */
2971 $$ = tree_cons ($1, $2, NULL_TREE);
2975 notype_declarator:
2976 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2977 { $$ = make_pointer_declarator ($2.t, $3); }
2978 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2979 { $$ = make_reference_declarator ($2.t, $3); }
2980 | '*' notype_declarator_intern %prec UNARY
2981 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2982 | '&' notype_declarator_intern %prec UNARY
2983 { $$ = make_reference_declarator (NULL_TREE, $2); }
2984 | ptr_to_mem cv_qualifiers notype_declarator_intern
2985 { tree arg = make_pointer_declarator ($2, $3);
2986 $$ = build_nt (SCOPE_REF, $1, arg);
2988 | direct_notype_declarator
2991 complex_notype_declarator:
2992 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2993 { $$ = make_pointer_declarator ($2.t, $3); }
2994 | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2995 { $$ = make_reference_declarator ($2.t, $3); }
2996 | '*' complex_notype_declarator %prec UNARY
2997 { $$ = make_pointer_declarator (NULL_TREE, $2); }
2998 | '&' complex_notype_declarator %prec UNARY
2999 { $$ = make_reference_declarator (NULL_TREE, $2); }
3000 | ptr_to_mem cv_qualifiers notype_declarator_intern
3001 { tree arg = make_pointer_declarator ($2, $3);
3002 $$ = build_nt (SCOPE_REF, $1, arg);
3004 | complex_direct_notype_declarator
3007 complex_direct_notype_declarator:
3008 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.'
3009 { $$ = make_call_declarator ($$, $2, $3, $4); }
3010 | '(' complex_notype_declarator ')'
3011 { $$ = $2; }
3012 | direct_notype_declarator '[' expr ']'
3013 { $$ = build_nt (ARRAY_REF, $$, $3); }
3014 | direct_notype_declarator '[' ']'
3015 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
3016 | notype_qualified_id
3017 { enter_scope_of ($1); }
3018 | global_scope notype_qualified_id
3019 { enter_scope_of ($2); $$ = $2;}
3020 | global_scope notype_unqualified_id
3021 { $$ = build_nt (SCOPE_REF, global_namespace, $2);
3022 enter_scope_of ($$);
3024 | nested_name_specifier notype_template_declarator
3025 { got_scope = NULL_TREE;
3026 $$ = build_nt (SCOPE_REF, $1, $2);
3027 enter_scope_of ($$);
3031 qualified_id:
3032 nested_name_specifier unqualified_id
3033 { got_scope = NULL_TREE;
3034 $$ = build_nt (SCOPE_REF, $$, $2); }
3035 | nested_name_specifier object_template_id
3036 { got_scope = NULL_TREE;
3037 $$ = build_nt (SCOPE_REF, $1, $2); }
3040 notype_qualified_id:
3041 nested_name_specifier notype_unqualified_id
3042 { got_scope = NULL_TREE;
3043 $$ = build_nt (SCOPE_REF, $$, $2); }
3044 | nested_name_specifier object_template_id
3045 { got_scope = NULL_TREE;
3046 $$ = build_nt (SCOPE_REF, $1, $2); }
3049 overqualified_id:
3050 notype_qualified_id
3051 | global_scope notype_qualified_id
3052 { $$ = $2; }
3055 functional_cast:
3056 typespec '(' nonnull_exprlist ')'
3057 { $$ = build_functional_cast ($1.t, $3); }
3058 | typespec '(' expr_or_declarator_intern ')'
3059 { $$ = reparse_decl_as_expr ($1.t, $3); }
3060 | typespec fcast_or_absdcl %prec EMPTY
3061 { $$ = reparse_absdcl_as_expr ($1.t, $2); }
3064 type_name:
3065 TYPENAME
3066 | SELFNAME
3067 | template_type %prec EMPTY
3070 nested_name_specifier:
3071 nested_name_specifier_1
3072 | nested_name_specifier nested_name_specifier_1
3073 { $$ = $2; }
3074 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
3075 { got_scope = $$
3076 = make_typename_type ($1, $3, tf_error); }
3077 /* Error handling per Core 125. */
3078 | nested_name_specifier IDENTIFIER SCOPE
3079 { got_scope = $$
3080 = make_typename_type ($1, $2, tf_error); }
3081 | nested_name_specifier PTYPENAME SCOPE
3082 { got_scope = $$
3083 = make_typename_type ($1, $2, tf_error); }
3086 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3087 inline here?!? (jason) */
3088 nested_name_specifier_1:
3089 TYPENAME SCOPE
3091 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3093 $$ = lastiddecl;
3094 maybe_note_name_used_in_class ($1, $$);
3096 got_scope = $$ =
3097 complete_type (TYPE_MAIN_VARIANT (TREE_TYPE ($$)));
3099 | SELFNAME SCOPE
3101 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3102 $$ = lastiddecl;
3103 got_scope = $$ = TREE_TYPE ($$);
3105 | NSNAME SCOPE
3107 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3108 $$ = lastiddecl;
3109 got_scope = $$;
3111 | template_type SCOPE
3112 { got_scope = $$ = complete_type (TREE_TYPE ($1)); }
3115 typename_sub:
3116 typename_sub0
3117 | global_scope typename_sub0
3118 { $$ = $2; }
3121 typename_sub0:
3122 typename_sub1 identifier %prec EMPTY
3124 if (TYPE_P ($1))
3125 $$ = make_typename_type ($1, $2, tf_error);
3126 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
3127 error ("`%T' is not a class or namespace", $2);
3128 else
3130 $$ = $2;
3131 if (TREE_CODE ($$) == TYPE_DECL)
3132 $$ = TREE_TYPE ($$);
3135 | typename_sub1 template_type %prec EMPTY
3136 { $$ = TREE_TYPE ($2); }
3137 | typename_sub1 explicit_template_type %prec EMPTY
3138 { $$ = make_typename_type ($1, $2, tf_error); }
3139 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
3140 { $$ = make_typename_type ($1, $3, tf_error); }
3143 typename_sub1:
3144 typename_sub2
3146 if (TREE_CODE ($1) == IDENTIFIER_NODE)
3147 error ("`%T' is not a class or namespace", $1);
3148 else if (TREE_CODE ($1) == TYPE_DECL)
3149 $$ = TREE_TYPE ($1);
3151 | typename_sub1 typename_sub2
3153 if (TYPE_P ($1))
3154 $$ = make_typename_type ($1, $2, tf_error);
3155 else if (TREE_CODE ($2) == IDENTIFIER_NODE)
3156 error ("`%T' is not a class or namespace", $2);
3157 else
3159 $$ = $2;
3160 if (TREE_CODE ($$) == TYPE_DECL)
3161 $$ = TREE_TYPE ($$);
3164 | typename_sub1 explicit_template_type SCOPE
3165 { got_scope = $$
3166 = make_typename_type ($1, $2, tf_error); }
3167 | typename_sub1 TEMPLATE explicit_template_type SCOPE
3168 { got_scope = $$
3169 = make_typename_type ($1, $3, tf_error); }
3172 /* This needs to return a TYPE_DECL for simple names so that we don't
3173 forget what name was used. */
3174 typename_sub2:
3175 TYPENAME SCOPE
3177 if (TREE_CODE ($1) != TYPE_DECL)
3178 $$ = lastiddecl;
3180 /* Retrieve the type for the identifier, which might involve
3181 some computation. */
3182 got_scope = complete_type (TREE_TYPE ($$));
3184 if ($$ == error_mark_node)
3185 error ("`%T' is not a class or namespace", $1);
3187 | SELFNAME SCOPE
3189 if (TREE_CODE ($1) != TYPE_DECL)
3190 $$ = lastiddecl;
3191 got_scope = complete_type (TREE_TYPE ($$));
3193 | template_type SCOPE
3194 { got_scope = $$ = complete_type (TREE_TYPE ($$)); }
3195 | PTYPENAME SCOPE
3196 | IDENTIFIER SCOPE
3197 | NSNAME SCOPE
3199 if (TREE_CODE ($$) == IDENTIFIER_NODE)
3200 $$ = lastiddecl;
3201 got_scope = $$;
3205 explicit_template_type:
3206 identifier '<' template_arg_list_opt template_close_bracket
3207 { $$ = build_min_nt (TEMPLATE_ID_EXPR, $1, $3); }
3210 complex_type_name:
3211 global_scope type_name
3213 if (TREE_CODE ($2) == IDENTIFIER_NODE)
3214 $$ = IDENTIFIER_GLOBAL_VALUE ($2);
3215 else
3216 $$ = $2;
3217 got_scope = NULL_TREE;
3219 | nested_type
3220 | global_scope nested_type
3221 { $$ = $2; }
3224 ptr_to_mem:
3225 nested_name_specifier '*'
3226 { got_scope = NULL_TREE; }
3227 | global_scope nested_name_specifier '*'
3228 { $$ = $2; got_scope = NULL_TREE; }
3231 /* All uses of explicit global scope must go through this nonterminal so
3232 that got_scope will be set before yylex is called to get the next token. */
3233 global_scope:
3234 SCOPE
3235 { got_scope = void_type_node; }
3238 /* ISO new-declarator (5.3.4) */
3239 new_declarator:
3240 '*' cv_qualifiers new_declarator
3241 { $$ = make_pointer_declarator ($2, $3); }
3242 | '*' cv_qualifiers %prec EMPTY
3243 { $$ = make_pointer_declarator ($2, NULL_TREE); }
3244 | '&' cv_qualifiers new_declarator %prec EMPTY
3245 { $$ = make_reference_declarator ($2, $3); }
3246 | '&' cv_qualifiers %prec EMPTY
3247 { $$ = make_reference_declarator ($2, NULL_TREE); }
3248 | ptr_to_mem cv_qualifiers %prec EMPTY
3249 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3250 $$ = build_nt (SCOPE_REF, $1, arg);
3252 | ptr_to_mem cv_qualifiers new_declarator
3253 { tree arg = make_pointer_declarator ($2, $3);
3254 $$ = build_nt (SCOPE_REF, $1, arg);
3256 | direct_new_declarator %prec EMPTY
3259 /* ISO direct-new-declarator (5.3.4) */
3260 direct_new_declarator:
3261 '[' expr ']'
3262 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
3263 | direct_new_declarator '[' expr ']'
3264 { $$ = build_nt (ARRAY_REF, $$, $3); }
3267 absdcl_intern:
3268 absdcl
3269 | attributes absdcl
3271 /* Provide support for '(' attributes '*' declarator ')'
3272 etc */
3273 $$ = tree_cons ($1, $2, NULL_TREE);
3277 /* ISO abstract-declarator (8.1) */
3278 absdcl:
3279 '*' nonempty_cv_qualifiers absdcl_intern
3280 { $$ = make_pointer_declarator ($2.t, $3); }
3281 | '*' absdcl_intern
3282 { $$ = make_pointer_declarator (NULL_TREE, $2); }
3283 | '*' nonempty_cv_qualifiers %prec EMPTY
3284 { $$ = make_pointer_declarator ($2.t, NULL_TREE); }
3285 | '*' %prec EMPTY
3286 { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
3287 | '&' nonempty_cv_qualifiers absdcl_intern
3288 { $$ = make_reference_declarator ($2.t, $3); }
3289 | '&' absdcl_intern
3290 { $$ = make_reference_declarator (NULL_TREE, $2); }
3291 | '&' nonempty_cv_qualifiers %prec EMPTY
3292 { $$ = make_reference_declarator ($2.t, NULL_TREE); }
3293 | '&' %prec EMPTY
3294 { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
3295 | ptr_to_mem cv_qualifiers %prec EMPTY
3296 { tree arg = make_pointer_declarator ($2, NULL_TREE);
3297 $$ = build_nt (SCOPE_REF, $1, arg);
3299 | ptr_to_mem cv_qualifiers absdcl_intern
3300 { tree arg = make_pointer_declarator ($2, $3);
3301 $$ = build_nt (SCOPE_REF, $1, arg);
3303 | direct_abstract_declarator %prec EMPTY
3306 /* ISO direct-abstract-declarator (8.1) */
3307 direct_abstract_declarator:
3308 '(' absdcl_intern ')'
3309 { $$ = $2; }
3310 /* `(typedef)1' is `int'. */
3311 | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3312 { $$ = make_call_declarator ($$, $3, $5, $6); }
3313 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.'
3314 { $$ = make_call_declarator ($$, empty_parms (), $3, $4); }
3315 | direct_abstract_declarator '[' expr ']' %prec '.'
3316 { $$ = build_nt (ARRAY_REF, $$, $3); }
3317 | direct_abstract_declarator '[' ']' %prec '.'
3318 { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); }
3319 | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.'
3320 { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); }
3321 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3322 { set_quals_and_spec ($$, $2, $3); }
3323 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.'
3324 { set_quals_and_spec ($$, $2, $3); }
3325 | '[' expr ']' %prec '.'
3326 { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }
3327 | '[' ']' %prec '.'
3328 { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }
3331 /* For C++, decls and stmts can be intermixed, so we don't need to
3332 have a special rule that won't start parsing the stmt section
3333 until we have a stmt that parses without errors. */
3335 stmts:
3336 stmt
3337 | errstmt
3338 | stmts stmt
3339 | stmts errstmt
3342 errstmt:
3343 error ';'
3346 /* Read zero or more forward-declarations for labels
3347 that nested functions can jump to. */
3348 maybe_label_decls:
3349 /* empty */
3350 | label_decls
3351 { if (pedantic)
3352 pedwarn ("ISO C++ forbids label declarations"); }
3355 label_decls:
3356 label_decl
3357 | label_decls label_decl
3360 label_decl:
3361 LABEL identifiers_or_typenames ';'
3363 while ($2)
3365 finish_label_decl (TREE_VALUE ($2));
3366 $2 = TREE_CHAIN ($2);
3371 compstmt_or_stmtexpr:
3372 save_lineno '{'
3373 { $<ttype>$ = begin_compound_stmt (0); }
3374 compstmtend
3375 { STMT_LINENO ($<ttype>3) = $1;
3376 finish_compound_stmt (0, $<ttype>3); }
3379 compstmt:
3380 compstmt_or_stmtexpr
3381 { last_expr_type = NULL_TREE; }
3384 simple_if:
3386 { $<ttype>$ = begin_if_stmt ();
3387 cond_stmt_keyword = "if"; }
3388 paren_cond_or_null
3389 { finish_if_stmt_cond ($3, $<ttype>2); }
3390 implicitly_scoped_stmt
3391 { $$ = $<ttype>2;
3392 finish_then_clause ($<ttype>2); }
3395 implicitly_scoped_stmt:
3396 compstmt
3398 { $<ttype>$ = begin_compound_stmt (0); }
3399 save_lineno simple_stmt
3400 { STMT_LINENO ($<ttype>1) = $2;
3401 if ($3) STMT_LINENO ($3) = $2;
3402 finish_compound_stmt (0, $<ttype>1); }
3405 stmt:
3406 compstmt
3407 | save_lineno simple_stmt
3408 { if ($2) STMT_LINENO ($2) = $1; }
3411 simple_stmt:
3412 decl
3413 { finish_stmt ();
3414 $$ = NULL_TREE; }
3415 | expr ';'
3416 { $$ = finish_expr_stmt ($1); }
3417 | simple_if ELSE
3418 { begin_else_clause (); }
3419 implicitly_scoped_stmt
3421 $$ = $1;
3422 finish_else_clause ($1);
3423 finish_if_stmt ();
3425 | simple_if %prec IF
3426 { $$ = $1;
3427 finish_if_stmt (); }
3428 | WHILE
3430 $<ttype>$ = begin_while_stmt ();
3431 cond_stmt_keyword = "while";
3433 paren_cond_or_null
3434 { finish_while_stmt_cond ($3, $<ttype>2); }
3435 implicitly_scoped_stmt
3436 { $$ = $<ttype>2;
3437 finish_while_stmt ($<ttype>2); }
3438 | DO
3439 { $<ttype>$ = begin_do_stmt (); }
3440 implicitly_scoped_stmt WHILE
3442 finish_do_body ($<ttype>2);
3443 cond_stmt_keyword = "do";
3445 paren_expr_or_null ';'
3446 { $$ = $<ttype>2;
3447 finish_do_stmt ($6, $<ttype>2); }
3448 | FOR
3449 { $<ttype>$ = begin_for_stmt (); }
3450 '(' for.init.statement
3451 { finish_for_init_stmt ($<ttype>2); }
3452 xcond ';'
3453 { finish_for_cond ($6, $<ttype>2); }
3454 xexpr ')'
3455 { finish_for_expr ($9, $<ttype>2); }
3456 implicitly_scoped_stmt
3457 { $$ = $<ttype>2;
3458 finish_for_stmt ($<ttype>2); }
3459 | SWITCH
3460 { $<ttype>$ = begin_switch_stmt (); }
3461 '(' condition ')'
3462 { finish_switch_cond ($4, $<ttype>2); }
3463 implicitly_scoped_stmt
3464 { $$ = $<ttype>2;
3465 finish_switch_stmt ($<ttype>2); }
3466 | CASE expr_no_commas ':'
3467 { $<ttype>$ = finish_case_label ($2, NULL_TREE); }
3468 stmt
3469 { $$ = $<ttype>4; }
3470 | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
3471 { $<ttype>$ = finish_case_label ($2, $4); }
3472 stmt
3473 { $$ = $<ttype>6; }
3474 | DEFAULT ':'
3475 { $<ttype>$ = finish_case_label (NULL_TREE, NULL_TREE); }
3476 stmt
3477 { $$ = $<ttype>3; }
3478 | BREAK ';'
3479 { $$ = finish_break_stmt (); }
3480 | CONTINUE ';'
3481 { $$ = finish_continue_stmt (); }
3482 | RETURN_KEYWORD ';'
3483 { $$ = finish_return_stmt (NULL_TREE); }
3484 | RETURN_KEYWORD expr ';'
3485 { $$ = finish_return_stmt ($2); }
3486 | asm_keyword maybe_cv_qualifier '(' string ')' ';'
3487 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE,
3488 NULL_TREE);
3489 ASM_INPUT_P ($$) = 1; }
3490 /* This is the case with just output operands. */
3491 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';'
3492 { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); }
3493 /* This is the case with input operands as well. */
3494 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3495 asm_operands ')' ';'
3496 { $$ = finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
3497 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ')' ';'
3498 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); }
3499 /* This is the case with clobbered registers as well. */
3500 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
3501 asm_operands ':' asm_clobbers ')' ';'
3502 { $$ = finish_asm_stmt ($2, $4, $6, $8, $10); }
3503 | asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ':'
3504 asm_clobbers ')' ';'
3505 { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); }
3506 | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands SCOPE
3507 asm_clobbers ')' ';'
3508 { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
3509 | GOTO '*' expr ';'
3511 if (pedantic)
3512 pedwarn ("ISO C++ forbids computed gotos");
3513 $$ = finish_goto_stmt ($3);
3515 | GOTO identifier ';'
3516 { $$ = finish_goto_stmt ($2); }
3517 | label_colon stmt
3518 { $$ = NULL_TREE; }
3519 | label_colon '}'
3520 { error ("label must be followed by statement");
3521 yyungetc ('}', 0);
3522 $$ = NULL_TREE; }
3523 | ';'
3524 { finish_stmt ();
3525 $$ = NULL_TREE; }
3526 | try_block
3527 { $$ = NULL_TREE; }
3528 | using_directive
3529 { $$ = NULL_TREE; }
3530 | namespace_using_decl
3531 { do_local_using_decl ($1);
3532 $$ = NULL_TREE; }
3533 | namespace_alias
3534 { $$ = NULL_TREE; }
3537 function_try_block:
3539 { $<ttype>$ = begin_function_try_block (); }
3540 function_body
3541 { finish_function_try_block ($<ttype>2); }
3542 handler_seq
3543 { finish_function_handler_sequence ($<ttype>2); }
3546 try_block:
3548 { $<ttype>$ = begin_try_block (); }
3549 compstmt
3550 { finish_try_block ($<ttype>2); }
3551 handler_seq
3552 { finish_handler_sequence ($<ttype>2); }
3555 handler_seq:
3556 handler
3557 | handler_seq handler
3558 | /* empty */
3559 { /* Generate a fake handler block to avoid later aborts. */
3560 tree fake_handler = begin_handler ();
3561 finish_handler_parms (NULL_TREE, fake_handler);
3562 finish_handler (fake_handler);
3563 $<ttype>$ = fake_handler;
3565 error ("must have at least one catch per try block");
3569 handler:
3570 CATCH
3571 { $<ttype>$ = begin_handler (); }
3572 handler_args
3573 { finish_handler_parms ($3, $<ttype>2); }
3574 compstmt
3575 { finish_handler ($<ttype>2); }
3578 type_specifier_seq:
3579 typed_typespecs %prec EMPTY
3580 | nonempty_cv_qualifiers %prec EMPTY
3583 handler_args:
3584 '(' ELLIPSIS ')'
3585 { $$ = NULL_TREE; }
3586 /* This doesn't allow reference parameters, the below does.
3587 | '(' type_specifier_seq absdcl ')'
3588 { check_for_new_type ("inside exception declarations", $2);
3589 expand_start_catch_block ($2.t, $3); }
3590 | '(' type_specifier_seq ')'
3591 { check_for_new_type ("inside exception declarations", $2);
3592 expand_start_catch_block ($2.t, NULL_TREE); }
3593 | '(' type_specifier_seq notype_declarator ')'
3594 { check_for_new_type ("inside exception declarations", $2);
3595 expand_start_catch_block ($2.t, $3); }
3596 | '(' typed_typespecs after_type_declarator ')'
3597 { check_for_new_type ("inside exception declarations", $2);
3598 expand_start_catch_block ($2.t, $3); }
3599 This allows reference parameters... */
3600 | '(' parm ')'
3602 check_for_new_type ("inside exception declarations", $2);
3603 $$ = start_handler_parms (TREE_PURPOSE ($2.t),
3604 TREE_VALUE ($2.t));
3608 label_colon:
3609 IDENTIFIER ':'
3610 { finish_label_stmt ($1); }
3611 | PTYPENAME ':'
3612 { finish_label_stmt ($1); }
3613 | TYPENAME ':'
3614 { finish_label_stmt ($1); }
3615 | SELFNAME ':'
3616 { finish_label_stmt ($1); }
3619 for.init.statement:
3620 xexpr ';'
3621 { finish_expr_stmt ($1); }
3622 | decl
3623 | '{' compstmtend
3624 { if (pedantic)
3625 pedwarn ("ISO C++ forbids compound statements inside for initializations");
3629 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3631 maybe_cv_qualifier:
3632 /* empty */
3633 { $$ = NULL_TREE; }
3634 | CV_QUALIFIER
3637 xexpr:
3638 /* empty */
3639 { $$ = NULL_TREE; }
3640 | expr
3641 | error
3642 { $$ = NULL_TREE; }
3645 /* These are the operands other than the first string and colon
3646 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3647 asm_operands:
3648 /* empty */
3649 { $$ = NULL_TREE; }
3650 | nonnull_asm_operands
3653 nonnull_asm_operands:
3654 asm_operand
3655 | nonnull_asm_operands ',' asm_operand
3656 { $$ = chainon ($$, $3); }
3659 asm_operand:
3660 STRING '(' expr ')'
3661 { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); }
3662 | '[' identifier ']' STRING '(' expr ')'
3663 { $$ = build_tree_list (build_tree_list ($2, $4), $6); }
3666 asm_clobbers:
3667 string
3668 { $$ = tree_cons (NULL_TREE, combine_strings ($1), NULL_TREE);}
3669 | asm_clobbers ',' string
3670 { $$ = tree_cons (NULL_TREE, combine_strings ($3), $1); }
3673 /* This is what appears inside the parens in a function declarator.
3674 Its value is represented in the format that grokdeclarator expects.
3676 In C++, declaring a function with no parameters
3677 means that that function takes *no* parameters. */
3679 parmlist:
3680 /* empty */
3682 $$ = empty_parms();
3684 | complex_parmlist
3685 | type_id
3686 { $$ = finish_parmlist (build_tree_list (NULL_TREE, $1.t), 0);
3687 check_for_new_type ("inside parameter list", $1); }
3690 /* This nonterminal does not include the common sequence '(' type_id ')',
3691 as it is ambiguous and must be disambiguated elsewhere. */
3692 complex_parmlist:
3693 parms
3694 { $$ = finish_parmlist ($$, 0); }
3695 | parms_comma ELLIPSIS
3696 { $$ = finish_parmlist ($1, 1); }
3697 /* C++ allows an ellipsis without a separating ',' */
3698 | parms ELLIPSIS
3699 { $$ = finish_parmlist ($1, 1); }
3700 | type_id ELLIPSIS
3701 { $$ = finish_parmlist (build_tree_list (NULL_TREE,
3702 $1.t), 1); }
3703 | ELLIPSIS
3704 { $$ = finish_parmlist (NULL_TREE, 1); }
3705 | parms ':'
3707 /* This helps us recover from really nasty
3708 parse errors, for example, a missing right
3709 parenthesis. */
3710 yyerror ("possibly missing ')'");
3711 $$ = finish_parmlist ($1, 0);
3712 yyungetc (':', 0);
3713 yychar = ')';
3715 | type_id ':'
3717 /* This helps us recover from really nasty
3718 parse errors, for example, a missing right
3719 parenthesis. */
3720 yyerror ("possibly missing ')'");
3721 $$ = finish_parmlist (build_tree_list (NULL_TREE,
3722 $1.t), 0);
3723 yyungetc (':', 0);
3724 yychar = ')';
3728 /* A default argument to a */
3729 defarg:
3731 { maybe_snarf_defarg (); }
3732 defarg1
3733 { $$ = $3; }
3736 defarg1:
3737 DEFARG
3738 | init
3741 /* A nonempty list of parameter declarations or type names. */
3742 parms:
3743 named_parm
3744 { check_for_new_type ("in a parameter list", $1);
3745 $$ = build_tree_list (NULL_TREE, $1.t); }
3746 | parm defarg
3747 { check_for_new_type ("in a parameter list", $1);
3748 $$ = build_tree_list ($2, $1.t); }
3749 | parms_comma full_parm
3750 { check_for_new_type ("in a parameter list", $2);
3751 $$ = chainon ($$, $2.t); }
3752 | parms_comma bad_parm
3753 { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
3754 | parms_comma bad_parm '=' init
3755 { $$ = chainon ($$, build_tree_list ($4, $2)); }
3758 parms_comma:
3759 parms ','
3760 | type_id ','
3761 { check_for_new_type ("in a parameter list", $1);
3762 $$ = build_tree_list (NULL_TREE, $1.t); }
3765 /* A single parameter declaration or parameter type name,
3766 as found in a parmlist. */
3767 named_parm:
3768 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3769 TYPESPEC IDENTIFIER. */
3770 typed_declspecs1 declarator
3771 { $$.new_type_flag = $1.new_type_flag;
3772 $$.t = build_tree_list ($1.t, $2); }
3773 | typed_typespecs declarator
3774 { $$.t = build_tree_list ($1.t, $2);
3775 $$.new_type_flag = $1.new_type_flag; }
3776 | typespec declarator
3777 { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t),
3778 $2);
3779 $$.new_type_flag = $1.new_type_flag; }
3780 | typed_declspecs1 absdcl
3781 { $$.t = build_tree_list ($1.t, $2);
3782 $$.new_type_flag = $1.new_type_flag; }
3783 | typed_declspecs1 %prec EMPTY
3784 { $$.t = build_tree_list ($1.t, NULL_TREE);
3785 $$.new_type_flag = $1.new_type_flag; }
3786 | declmods notype_declarator
3787 { $$.t = build_tree_list ($1.t, $2);
3788 $$.new_type_flag = 0; }
3791 full_parm:
3792 parm
3793 { $$.t = build_tree_list (NULL_TREE, $1.t);
3794 $$.new_type_flag = $1.new_type_flag; }
3795 | parm defarg
3796 { $$.t = build_tree_list ($2, $1.t);
3797 $$.new_type_flag = $1.new_type_flag; }
3800 parm:
3801 named_parm
3802 | type_id
3805 see_typename:
3806 /* empty */ %prec EMPTY
3807 { see_typename (); }
3810 bad_parm:
3811 /* empty */ %prec EMPTY
3813 error ("type specifier omitted for parameter");
3814 $$ = build_tree_list (integer_type_node, NULL_TREE);
3816 | notype_declarator
3818 if (TREE_CODE ($$) == SCOPE_REF)
3820 if (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM
3821 || TREE_CODE (TREE_OPERAND ($$, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM)
3822 error ("`%E' is not a type, use `typename %E' to make it one", $$);
3823 else
3824 error ("no type `%D' in `%T'", TREE_OPERAND ($$, 1), TREE_OPERAND ($$, 0));
3826 else
3827 error ("type specifier omitted for parameter `%E'", $$);
3828 $$ = build_tree_list (integer_type_node, $$);
3832 bad_decl:
3833 IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore ';'
3835 error("'%D' is used as a type, but is not defined as a type.", $1);
3836 $3 = error_mark_node;
3840 template_arg_list_ignore:
3841 '<' template_arg_list_opt template_close_bracket
3843 | /* empty */
3846 arg_list_ignore:
3847 '(' nonnull_exprlist ')'
3849 | /* empty */
3852 exception_specification_opt:
3853 /* empty */ %prec EMPTY
3854 { $$ = NULL_TREE; }
3855 | THROW '(' ansi_raise_identifiers ')' %prec EMPTY
3856 { $$ = $3; }
3857 | THROW LEFT_RIGHT %prec EMPTY
3858 { $$ = empty_except_spec; }
3861 ansi_raise_identifier:
3862 type_id
3864 check_for_new_type ("exception specifier", $1);
3865 $$ = groktypename ($1.t);
3867 | error
3868 { $$ = error_mark_node; }
3871 ansi_raise_identifiers:
3872 ansi_raise_identifier
3873 { $$ = add_exception_specifier (NULL_TREE, $1, 1); }
3874 | ansi_raise_identifiers ',' ansi_raise_identifier
3875 { $$ = add_exception_specifier ($1, $3, 1); }
3878 conversion_declarator:
3879 /* empty */ %prec EMPTY
3880 { $$ = NULL_TREE; }
3881 | '*' cv_qualifiers conversion_declarator
3882 { $$ = make_pointer_declarator ($2, $3); }
3883 | '&' cv_qualifiers conversion_declarator
3884 { $$ = make_reference_declarator ($2, $3); }
3885 | ptr_to_mem cv_qualifiers conversion_declarator
3886 { tree arg = make_pointer_declarator ($2, $3);
3887 $$ = build_nt (SCOPE_REF, $1, arg);
3891 operator:
3892 OPERATOR
3894 saved_scopes = tree_cons (got_scope, got_object, saved_scopes);
3895 TREE_LANG_FLAG_0 (saved_scopes) = looking_for_typename;
3896 /* We look for conversion-type-id's in both the class and current
3897 scopes, just as for ID in 'ptr->ID::'. */
3898 looking_for_typename = 1;
3899 got_object = got_scope;
3900 got_scope = NULL_TREE;
3904 unoperator:
3905 { got_scope = TREE_PURPOSE (saved_scopes);
3906 got_object = TREE_VALUE (saved_scopes);
3907 looking_for_typename = TREE_LANG_FLAG_0 (saved_scopes);
3908 saved_scopes = TREE_CHAIN (saved_scopes);
3912 operator_name:
3913 operator '*' unoperator
3914 { $$ = frob_opname (ansi_opname (MULT_EXPR)); }
3915 | operator '/' unoperator
3916 { $$ = frob_opname (ansi_opname (TRUNC_DIV_EXPR)); }
3917 | operator '%' unoperator
3918 { $$ = frob_opname (ansi_opname (TRUNC_MOD_EXPR)); }
3919 | operator '+' unoperator
3920 { $$ = frob_opname (ansi_opname (PLUS_EXPR)); }
3921 | operator '-' unoperator
3922 { $$ = frob_opname (ansi_opname (MINUS_EXPR)); }
3923 | operator '&' unoperator
3924 { $$ = frob_opname (ansi_opname (BIT_AND_EXPR)); }
3925 | operator '|' unoperator
3926 { $$ = frob_opname (ansi_opname (BIT_IOR_EXPR)); }
3927 | operator '^' unoperator
3928 { $$ = frob_opname (ansi_opname (BIT_XOR_EXPR)); }
3929 | operator '~' unoperator
3930 { $$ = frob_opname (ansi_opname (BIT_NOT_EXPR)); }
3931 | operator ',' unoperator
3932 { $$ = frob_opname (ansi_opname (COMPOUND_EXPR)); }
3933 | operator ARITHCOMPARE unoperator
3934 { $$ = frob_opname (ansi_opname ($2)); }
3935 | operator '<' unoperator
3936 { $$ = frob_opname (ansi_opname (LT_EXPR)); }
3937 | operator '>' unoperator
3938 { $$ = frob_opname (ansi_opname (GT_EXPR)); }
3939 | operator EQCOMPARE unoperator
3940 { $$ = frob_opname (ansi_opname ($2)); }
3941 | operator ASSIGN unoperator
3942 { $$ = frob_opname (ansi_assopname ($2)); }
3943 | operator '=' unoperator
3944 { $$ = frob_opname (ansi_assopname (NOP_EXPR)); }
3945 | operator LSHIFT unoperator
3946 { $$ = frob_opname (ansi_opname ($2)); }
3947 | operator RSHIFT unoperator
3948 { $$ = frob_opname (ansi_opname ($2)); }
3949 | operator PLUSPLUS unoperator
3950 { $$ = frob_opname (ansi_opname (POSTINCREMENT_EXPR)); }
3951 | operator MINUSMINUS unoperator
3952 { $$ = frob_opname (ansi_opname (PREDECREMENT_EXPR)); }
3953 | operator ANDAND unoperator
3954 { $$ = frob_opname (ansi_opname (TRUTH_ANDIF_EXPR)); }
3955 | operator OROR unoperator
3956 { $$ = frob_opname (ansi_opname (TRUTH_ORIF_EXPR)); }
3957 | operator '!' unoperator
3958 { $$ = frob_opname (ansi_opname (TRUTH_NOT_EXPR)); }
3959 | operator '?' ':' unoperator
3960 { $$ = frob_opname (ansi_opname (COND_EXPR)); }
3961 | operator MIN_MAX unoperator
3962 { $$ = frob_opname (ansi_opname ($2)); }
3963 | operator POINTSAT unoperator %prec EMPTY
3964 { $$ = frob_opname (ansi_opname (COMPONENT_REF)); }
3965 | operator POINTSAT_STAR unoperator %prec EMPTY
3966 { $$ = frob_opname (ansi_opname (MEMBER_REF)); }
3967 | operator LEFT_RIGHT unoperator
3968 { $$ = frob_opname (ansi_opname (CALL_EXPR)); }
3969 | operator '[' ']' unoperator
3970 { $$ = frob_opname (ansi_opname (ARRAY_REF)); }
3971 | operator NEW unoperator %prec EMPTY
3972 { $$ = frob_opname (ansi_opname (NEW_EXPR)); }
3973 | operator DELETE unoperator %prec EMPTY
3974 { $$ = frob_opname (ansi_opname (DELETE_EXPR)); }
3975 | operator NEW '[' ']' unoperator
3976 { $$ = frob_opname (ansi_opname (VEC_NEW_EXPR)); }
3977 | operator DELETE '[' ']' unoperator
3978 { $$ = frob_opname (ansi_opname (VEC_DELETE_EXPR)); }
3979 | operator type_specifier_seq conversion_declarator unoperator
3980 { $$ = frob_opname (grokoptypename ($2.t, $3)); }
3981 | operator error unoperator
3982 { $$ = frob_opname (ansi_opname (ERROR_MARK)); }
3985 /* The forced readahead in here is because we might be at the end of a
3986 line, and lineno won't be bumped until yylex absorbs the first token
3987 on the next line. */
3988 save_lineno:
3989 { if (yychar == YYEMPTY)
3990 yychar = YYLEX;
3991 $$ = lineno; }
3995 #ifdef SPEW_DEBUG
3996 const char *
3997 debug_yytranslate (value)
3998 int value;
4000 return yytname[YYTRANSLATE (value)];
4003 #endif