1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001 Free Software Foundation, Inc.
4 Hacked by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* This grammar is based on the GNU CC grammar. */
26 /* Note: Bison automatically applies a default action of "$$ = $1" for
27 all derivations; this is applied before the explicit action, if one
28 is given. Keep this in mind when reading the actions. */
31 /* Cause the `yydebug' variable to be defined. */
48 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. */
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
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
));
92 /* Cons up an empty parameter list. */
98 #ifndef NO_IMPLICIT_EXTERN_C
99 if
(in_system_header
&& current_class_type
== NULL
100 && current_lang_name
== lang_name_c
)
104 parms
= void_list_node
;
108 /* Record the decl-specifiers, attributes and type lookups from the
109 decl-specifier-seq in a declaration. */
112 frob_specs
(specs_attrs
, lookups
)
113 tree specs_attrs
, lookups
;
115 save_type_access_control
(lookups
);
116 split_specs_attrs
(specs_attrs
, ¤t_declspecs
, &prefix_attributes
);
117 if
(current_declspecs
118 && TREE_CODE
(current_declspecs
) != TREE_LIST
)
119 current_declspecs
= build_tree_list
(NULL_TREE
, current_declspecs
);
120 if
(have_extern_spec
&& !used_extern_spec
)
122 current_declspecs
= tree_cons
(NULL_TREE
,
123 get_identifier
("extern"),
125 used_extern_spec
= 1;
130 parse_decl
(declarator
, attributes
, initialized
)
131 tree declarator
, attributes
;
134 return start_decl
(declarator
, current_declspecs
, initialized
,
135 attributes
, prefix_attributes
);
139 parse_decl0
(declarator
, specs_attrs
, lookups
, attributes
, initialized
)
140 tree declarator
, specs_attrs
, lookups
, attributes
;
143 frob_specs
(specs_attrs
, lookups
);
144 return parse_decl
(declarator
, attributes
, initialized
);
148 parse_end_decl
(decl
, init
, asmspec
)
149 tree decl
, init
, asmspec
;
151 /* If decl is NULL_TREE, then this was a variable declaration using
152 () syntax for the initializer, so we handled it in grokdeclarator. */
154 decl_type_access_control
(decl
);
155 cp_finish_decl
(decl
, init
, asmspec
, init ? LOOKUP_ONLYCONVERTING
: 0);
159 parse_field
(declarator
, attributes
, asmspec
, init
)
160 tree declarator
, attributes
, asmspec
, init
;
162 tree d
= grokfield
(declarator
, current_declspecs
, init
, asmspec
,
163 chainon
(attributes
, prefix_attributes
));
164 decl_type_access_control
(d
);
169 parse_field0
(declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
)
170 tree declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
;
172 frob_specs
(specs_attrs
, lookups
);
173 return parse_field
(declarator
, attributes
, asmspec
, init
);
177 parse_bitfield
(declarator
, attributes
, width
)
178 tree declarator
, attributes
, width
;
180 tree d
= grokbitfield
(declarator
, current_declspecs
, width
);
181 cplus_decl_attributes
(&d
, chainon
(attributes
, prefix_attributes
), 0);
182 decl_type_access_control
(d
);
187 parse_bitfield0
(declarator
, specs_attrs
, lookups
, attributes
, width
)
188 tree declarator
, specs_attrs
, lookups
, attributes
, width
;
190 frob_specs
(specs_attrs
, lookups
);
191 return parse_bitfield
(declarator
, attributes
, width
);
195 parse_method
(declarator
, specs_attrs
, lookups
)
196 tree declarator
, specs_attrs
, lookups
;
199 frob_specs
(specs_attrs
, lookups
);
200 d
= start_method
(current_declspecs
, declarator
, prefix_attributes
);
201 decl_type_access_control
(d
);
208 ggc_add_tree_root
(¤t_declspecs
, 1);
209 ggc_add_tree_root
(&prefix_attributes
, 1);
210 ggc_add_tree_root
(¤t_enum_type
, 1);
211 ggc_add_tree_root
(&saved_scopes
, 1);
214 /* Rename the "yyparse" function so that we can override it elsewhere. */
215 #define yyparse yyparse_1
225 flagged_type_tree ftype
;
226 struct unparsed_text
*pi
;
229 /* All identifiers that are not reserved words
230 and are not declared typedefs in the current block */
233 /* All identifiers that are declared typedefs in the current block.
234 In some contexts, they are treated just like IDENTIFIER,
235 but they can also serve as typespecs in declarations. */
239 /* A template function. */
242 /* Reserved words that specify storage class.
243 yylval contains an IDENTIFIER_NODE which indicates which one. */
246 /* Reserved words that specify type.
247 yylval contains an IDENTIFIER_NODE which indicates which one. */
250 /* Reserved words that qualify type: "const" or "volatile".
251 yylval contains an IDENTIFIER_NODE which indicates which one. */
254 /* Character or numeric constants.
255 yylval is the node for the constant. */
258 /* __func__, __FUNCTION__ or __PRETTY_FUNCTION__.
259 yylval contains an IDENTIFIER_NODE which indicates which one. */
262 /* String constants in raw form.
263 yylval is a STRING_CST node. */
266 /* "...", used for functions with variable arglists. */
269 /* the reserved words */
270 /* SCO include files test "ASM", so use something else. */
271 %token SIZEOF ENUM
/* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
272 %token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
274 %token ATTRIBUTE EXTENSION LABEL
275 %token REALPART IMAGPART VA_ARG
277 /* the reserved words... C++ extensions */
279 %token
<ttype
> VISSPEC
280 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
281 %token NAMESPACE TYPENAME_KEYWORD USING
282 %token LEFT_RIGHT TEMPLATE
283 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
286 /* Define the operator tokens and their precedences.
287 The value is an integer because, if used, it is the tree code
288 to use in the expression made from the operator. */
290 %left EMPTY
/* used to resolve s/r with epsilon */
294 /* Add precedence rules to solve dangling else s/r conflict */
298 %left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
304 %right
<code
> ASSIGN
'='
312 %left
<code
> EQCOMPARE
313 %left
<code
> ARITHCOMPARE
'<' '>'
314 %left
<code
> LSHIFT RSHIFT
316 %left
<code
> '*' '/' '%'
317 %left
<code
> POINTSAT_STAR DOT_STAR
318 %right
<code
> UNARY PLUSPLUS MINUSMINUS
'~'
320 %left
<ttype
> LEFT_RIGHT
321 %left
<code
> POINTSAT
'.' '(' '['
323 %right SCOPE
/* C++ extension */
324 %nonassoc NEW DELETE TRY CATCH
328 %type
<ttype
> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
329 %type
<ttype
> PFUNCNAME maybe_identifier
330 %type
<ttype
> paren_expr_or_null nontrivial_exprlist SELFNAME
331 %type
<ttype
> expr_no_commas expr_no_comma_rangle
332 %type
<ttype
> cast_expr unary_expr primary
string STRING
333 %type
<ttype
> reserved_declspecs boolean.literal
334 %type
<ttype
> reserved_typespecquals
335 %type
<ttype
> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
336 %type
<ttype
> init initlist maybeasm maybe_init defarg defarg1
337 %type
<ttype
> asm_operands nonnull_asm_operands asm_operand asm_clobbers
338 %type
<ttype
> maybe_attribute attributes attribute attribute_list attrib
339 %type
<ttype
> any_word
341 %type
<itype
> save_lineno
342 %type
<ttype
> simple_stmt simple_if
344 %type
<ttype
> declarator notype_declarator after_type_declarator
345 %type
<ttype
> notype_declarator_intern absdcl_intern
346 %type
<ttype
> after_type_declarator_intern
347 %type
<ttype
> direct_notype_declarator direct_after_type_declarator
348 %type
<itype
> components notype_components
349 %type
<ttype
> component_decl component_decl_1
350 %type
<ttype
> component_declarator component_declarator0
351 %type
<ttype
> notype_component_declarator notype_component_declarator0
352 %type
<ttype
> after_type_component_declarator after_type_component_declarator0
353 %type
<ttype
> absdcl cv_qualifiers
354 %type
<ttype
> direct_abstract_declarator conversion_declarator
355 %type
<ttype
> new_declarator direct_new_declarator
356 %type
<ttype
> xexpr parmlist parms bad_parm
357 %type
<ttype
> identifiers_or_typenames
358 %type
<ttype
> fcast_or_absdcl regcast_or_absdcl
359 %type
<ttype
> expr_or_declarator expr_or_declarator_intern
360 %type
<ttype
> complex_notype_declarator
361 %type
<ttype
> notype_unqualified_id unqualified_id qualified_id
362 %type
<ttype
> template_id do_id object_template_id notype_template_declarator
363 %type
<ttype
> overqualified_id notype_qualified_id any_id
364 %type
<ttype
> complex_direct_notype_declarator functional_cast
365 %type
<ttype
> complex_parmlist parms_comma
366 %type
<ttype
> namespace_qualifier namespace_using_decl
368 %type
<ftype
> type_id new_type_id typed_typespecs typespec typed_declspecs
369 %type
<ftype
> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
370 %type
<ftype
> structsp typespecqual_reserved parm named_parm full_parm
371 %type
<ftype
> declmods
373 %type
<itype
> extension
376 %token
<ttype
> PTYPENAME
377 %token
<ttype
> EXTERN_LANG_STRING ALL
378 %token
<ttype
> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
379 %token
<pi
> PRE_PARSED_FUNCTION_DECL
380 %type
<ttype
> component_constructor_declarator
381 %type
<ttype
> fn.def2 return_id constructor_declarator
382 %type
<itype
> ctor_initializer_opt function_try_block
383 %type
<ttype
> named_class_head_sans_basetype
384 %type
<ftype
> class_head named_class_head
385 %type
<ftype
> named_complex_class_head_sans_basetype
386 %type
<ttype
> unnamed_class_head
387 %type
<ttype
> base_class_list
388 %type
<ttype
> base_class_access_list
389 %type
<ttype
> base_class maybe_base_class_list base_class
.1
390 %type
<ttype
> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
391 %type
<ttype
> operator_name
392 %type
<ttype
> object aggr
393 %type
<itype
> new delete
394 /* %type <ttype> primary_no_id */
395 %type
<ttype
> maybe_parmlist
396 %type
<ttype
> member_init
397 %type
<ftype
> member_init_list
398 %type
<ttype
> template_parm_header template_spec_header template_header
399 %type
<ttype
> template_parm_list template_parm
400 %type
<ttype
> template_type_parm template_template_parm
401 %type
<code
> template_close_bracket
402 %type
<ttype
> apparent_template_type
403 %type
<ttype
> template_type template_arg_list template_arg_list_opt
404 %type
<ttype
> template_arg
405 %type
<ttype
> condition xcond paren_cond_or_null
406 %type
<ttype
> type_name nested_name_specifier nested_type ptr_to_mem
407 %type
<ttype
> complete_type_name notype_identifier nonnested_type
408 %type
<ttype
> complex_type_name nested_name_specifier_1
409 %type
<ttype
> new_initializer new_placement
410 %type
<ttype
> using_decl
411 %type
<ttype
> typename_sub typename_sub0 typename_sub1 typename_sub2
412 %type
<ttype
> explicit_template_type
413 /* in order to recognize aggr tags as defining and thus shadowing. */
414 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
415 %type
<ttype
> named_class_head_sans_basetype_defn
416 %type
<ttype
> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
417 %type
<ttype
> handler_args
418 %type
<ttype
> self_template_type .finish_template_type
423 /* Used in lex.c for parsing pragmas. */
426 /* lex.c and pt.c depend on this being the last token. Define
427 any new tokens before this one! */
428 %token END_OF_SAVED_INPUT
431 /* Tell yyparse how to print a token's value, if yydebug is set. */
432 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
433 extern
void yyprint PARAMS
((FILE *, int, YYSTYPE));
439 { finish_translation_unit
(); }
441 { finish_translation_unit
(); }
444 /* the reason for the strange actions in this rule
445 is so that notype_initdecls when reached via datadef
446 can find a valid list of type and sc specs in $0. */
449 { $
<ttype
>$
= NULL_TREE
; }
451 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
452 | extdefs lang_extdef
453 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
462 { have_extern_spec
= 1;
463 used_extern_spec
= 0;
464 $
<ttype
>$
= NULL_TREE
; }
467 { have_extern_spec
= 0; }
481 { if
(pending_lang_change
) do_pending_lang_change
();
482 type_lookups
= NULL_TREE
; }
484 { if
(! toplevel_bindings_p
())
489 fndef eat_saved_input
490 { do_pending_inlines
(); }
492 { do_pending_inlines
(); }
495 { cp_warning
("keyword `export' not implemented, and will be ignored"); }
497 { do_pending_inlines
(); }
499 { do_pending_inlines
(); }
500 | asm_keyword
'(' string ')' ';'
501 { if
(TREE_CHAIN
($3)) $3 = combine_strings
($3);
503 | extern_lang_string
'{' extdefs_opt
'}'
504 { pop_lang_context
(); }
505 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
506 { do_pending_inlines
(); pop_lang_context
(); }
507 | extern_lang_string .hush_warning datadef .warning_ok
508 { do_pending_inlines
(); pop_lang_context
(); }
509 | NAMESPACE identifier
'{'
510 { push_namespace
($2); }
512 { pop_namespace
(); }
514 { push_namespace
(NULL_TREE
); }
516 { pop_namespace
(); }
519 { do_toplevel_using_decl
($1); }
526 NAMESPACE identifier
'='
527 { begin_only_namespace_names
(); }
530 end_only_namespace_names
();
533 do_namespace_alias
($2, $5);
540 | USING global_scope qualified_id
542 | USING global_scope unqualified_id
546 namespace_using_decl:
547 USING namespace_qualifier identifier
548 { $$
= build_nt
(SCOPE_REF
, $2, $3); }
549 | USING global_scope identifier
550 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $3); }
551 | USING global_scope namespace_qualifier identifier
552 { $$
= build_nt
(SCOPE_REF
, $3, $4); }
557 { begin_only_namespace_names
(); }
560 end_only_namespace_names
();
561 /* If no declaration was found, the using-directive is
562 invalid. Since that was not reported, we need the
563 identifier for the error message. */
564 if
(TREE_CODE
($4) == IDENTIFIER_NODE
&& lastiddecl
)
566 do_using_directive
($4);
573 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
577 | namespace_qualifier NSNAME SCOPE
580 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
588 | global_scope qualified_id
590 | global_scope unqualified_id
596 { push_lang_context
($1); }
597 | extern_lang_string EXTERN_LANG_STRING
598 { if
(current_lang_name
!= $2)
599 cp_error
("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name
);
600 pop_lang_context
(); push_lang_context
($2); }
603 template_parm_header:
605 { begin_template_parm_list
(); }
606 template_parm_list
'>'
607 { $$
= end_template_parm_list
($4); }
610 template_spec_header:
612 { begin_specialization
();
618 | template_spec_header
623 { $$
= process_template_parm
(NULL_TREE
, $1); }
624 | template_parm_list
',' template_parm
625 { $$
= process_template_parm
($1, $3); }
635 aggr maybe_identifier
636 { $$
= finish_template_type_parm
($1, $2); }
637 | TYPENAME_KEYWORD maybe_identifier
638 { $$
= finish_template_type_parm
(class_type_node
, $2); }
641 template_template_parm:
642 template_parm_header aggr maybe_identifier
643 { $$
= finish_template_template_parm
($2, $3); }
647 /* The following rules introduce a new reduce/reduce
648 conflict on the ',' and '>' input tokens: they are valid
649 prefixes for a `structsp', which means they could match a
650 nameless parameter. See 14.6, paragraph 3.
651 By putting them before the `parm' rule, we get
652 their match before considering them nameless parameter
655 { $$
= build_tree_list
(NULL_TREE
, $1); }
656 | template_type_parm
'=' type_id
657 { $$
= build_tree_list
(groktypename
($3.t
), $1); }
659 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
660 | parm
'=' expr_no_comma_rangle
661 { $$
= build_tree_list
($3, $1.t
); }
662 | template_template_parm
663 { $$
= build_tree_list
(NULL_TREE
, $1); }
664 | template_template_parm
'=' template_arg
666 if
(TREE_CODE
($3) != TEMPLATE_DECL
667 && TREE_CODE
($3) != TEMPLATE_TEMPLATE_PARM
668 && TREE_CODE
($3) != TYPE_DECL
669 && TREE_CODE
($3) != UNBOUND_CLASS_TEMPLATE
)
671 error ("invalid default template argument");
672 $3 = error_mark_node
;
674 $$
= build_tree_list
($3, $1);
679 template_header template_extdef
680 { finish_template_decl
($1); }
681 | template_header
error %prec EMPTY
682 { finish_template_decl
($1); }
686 fndef eat_saved_input
687 { do_pending_inlines
(); }
689 { do_pending_inlines
(); }
691 { do_pending_inlines
(); }
692 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
693 { do_pending_inlines
();
694 pop_lang_context
(); }
695 | extern_lang_string .hush_warning template_datadef .warning_ok
696 { do_pending_inlines
();
697 pop_lang_context
(); }
698 | extension template_extdef
704 | declmods notype_initdecls
';'
706 | typed_declspecs initdecls
';'
707 { note_list_got_semicolon
($1.t
); }
710 if
($1.t
!= error_mark_node
)
712 maybe_process_partial_specialization
($1.t
);
713 note_got_semicolon
($1.t
);
720 | declmods notype_initdecls
';'
722 | typed_declspecs initdecls
';'
723 { note_list_got_semicolon
($1.t
); }
725 { pedwarn
("empty declaration"); }
726 | explicit_instantiation
';'
727 | typed_declspecs
';'
730 split_specs_attrs
($1.t
, &t
, &attrs
);
732 note_list_got_semicolon
($1.t
);
736 |
error END_OF_SAVED_INPUT
742 ctor_initializer_opt:
761 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
762 { expand_body
(finish_function
((int)$3)); }
763 | fn.def1 maybe_return_init function_try_block
764 { expand_body
(finish_function
((int)$3)); }
765 | fn.def1 maybe_return_init
error
769 constructor_declarator:
770 nested_name_specifier SELFNAME
'('
771 { $$
= begin_constructor_declarator
($1, $2); }
772 parmlist
')' cv_qualifiers exception_specification_opt
773 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
774 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
775 { $$
= begin_constructor_declarator
($1, $2);
776 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
778 | global_scope nested_name_specifier SELFNAME
'('
779 { $$
= begin_constructor_declarator
($2, $3); }
780 parmlist
')' cv_qualifiers exception_specification_opt
781 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
782 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
783 { $$
= begin_constructor_declarator
($2, $3);
784 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
786 | nested_name_specifier self_template_type
'('
787 { $$
= begin_constructor_declarator
($1, $2); }
788 parmlist
')' cv_qualifiers exception_specification_opt
789 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
790 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
791 { $$
= begin_constructor_declarator
($1, $2);
792 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
794 | global_scope nested_name_specifier self_template_type
'('
795 { $$
= begin_constructor_declarator
($2, $3); }
796 parmlist
')' cv_qualifiers exception_specification_opt
797 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
798 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
799 { $$
= begin_constructor_declarator
($2, $3);
800 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
805 typed_declspecs declarator
806 { check_for_new_type
("return type", $1);
807 if
(!begin_function_definition
($1.t
, $2))
809 | declmods notype_declarator
810 { if
(!begin_function_definition
($1.t
, $2))
813 { if
(!begin_function_definition
(NULL_TREE
, $1))
815 | declmods constructor_declarator
816 { if
(!begin_function_definition
($1.t
, $2))
818 | constructor_declarator
819 { if
(!begin_function_definition
(NULL_TREE
, $1))
823 /* ANSI allows optional parentheses around constructor class names.
824 See ISO/IEC 14882:1998(E) 12.1. */
826 component_constructor_declarator:
827 SELFNAME
'(' parmlist
')' cv_qualifiers exception_specification_opt
828 { $$
= make_call_declarator
($1, $3, $5, $6); }
829 |
'(' SELFNAME
')' '(' parmlist
')' cv_qualifiers
830 exception_specification_opt
831 { $$
= make_call_declarator
($2, $5, $7, $8); }
832 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
833 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
834 |
'(' SELFNAME
')' LEFT_RIGHT cv_qualifiers exception_specification_opt
835 { $$
= make_call_declarator
($2, empty_parms
(), $5, $6); }
836 | self_template_type
'(' parmlist
')' cv_qualifiers exception_specification_opt
837 { $$
= make_call_declarator
($1, $3, $5, $6); }
838 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
839 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
842 /* more C++ complexity. See component_decl for a comment on the
843 reduce/reduce conflict introduced by these rules. */
845 declmods component_constructor_declarator
846 { $$
= parse_method
($2, $1.t
, $1.lookups
);
850 if
(yychar == YYEMPTY
)
853 | component_constructor_declarator
854 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
856 | typed_declspecs declarator
857 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
858 | declmods notype_declarator
859 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
861 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
863 | declmods constructor_declarator
864 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
865 | constructor_declarator
866 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
871 RETURN_KEYWORD IDENTIFIER
879 { finish_named_return_value
($
<ttype
>$
, $2); }
880 | return_id
'(' nonnull_exprlist
')'
881 { finish_named_return_value
($
<ttype
>$
, $3); }
882 | return_id LEFT_RIGHT
883 { finish_named_return_value
($
<ttype
>$
, NULL_TREE
); }
887 ':' .set_base_init member_init_list
889 if
($3.new_type_flag
== 0)
890 error ("no base or member initializers given following ':'");
892 finish_mem_initializers
($3.t
);
899 if
(DECL_CONSTRUCTOR_P
(current_function_decl
))
900 /* Make a contour for the initializer list. */
902 else if
(current_class_type
== NULL_TREE
)
903 error ("base initializers not allowed for non-member functions");
904 else if
(! DECL_CONSTRUCTOR_P
(current_function_decl
))
905 error ("only constructors take base initializers");
912 $$.new_type_flag
= 0;
917 $$.new_type_flag
= 1;
920 | member_init_list
',' member_init
924 $$.new_type_flag
= 1;
925 TREE_CHAIN
($3) = $1.t
;
931 | member_init_list
error
935 '(' nonnull_exprlist
')'
937 if
(current_class_name
)
938 pedwarn
("anachronistic old style base class initializer");
939 $$
= expand_member_init
(current_class_ref
, NULL_TREE
, $2);
943 if
(current_class_name
)
944 pedwarn
("anachronistic old style base class initializer");
945 $$
= expand_member_init
(current_class_ref
,
949 | notype_identifier
'(' nonnull_exprlist
')'
950 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
951 | notype_identifier LEFT_RIGHT
952 { $$
= expand_member_init
(current_class_ref
, $1,
954 | nonnested_type
'(' nonnull_exprlist
')'
955 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
956 | nonnested_type LEFT_RIGHT
957 { $$
= expand_member_init
(current_class_ref
, $1,
959 | typename_sub
'(' nonnull_exprlist
')'
960 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
961 | typename_sub LEFT_RIGHT
962 { $$
= expand_member_init
(current_class_ref
, $1,
988 explicit_instantiation:
989 TEMPLATE begin_explicit_instantiation typespec
';'
990 { do_type_instantiation
($3.t
, NULL_TREE
, 1);
992 end_explicit_instantiation
993 | TEMPLATE begin_explicit_instantiation typed_declspecs declarator
994 { tree specs
= strip_attrs
($3.t
);
995 do_decl_instantiation
(specs
, $4, NULL_TREE
); }
996 end_explicit_instantiation
997 | TEMPLATE begin_explicit_instantiation notype_declarator
998 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
999 end_explicit_instantiation
1000 | TEMPLATE begin_explicit_instantiation constructor_declarator
1001 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
1002 end_explicit_instantiation
1003 | SCSPEC TEMPLATE begin_explicit_instantiation typespec
';'
1004 { do_type_instantiation
($4.t
, $1, 1);
1005 yyungetc
(';', 1); }
1006 end_explicit_instantiation
1007 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
1009 { tree specs
= strip_attrs
($4.t
);
1010 do_decl_instantiation
(specs
, $5, $1); }
1011 end_explicit_instantiation
1012 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
1013 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1014 end_explicit_instantiation
1015 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
1016 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1017 end_explicit_instantiation
1020 begin_explicit_instantiation:
1021 { begin_explicit_instantiation
(); }
1023 end_explicit_instantiation:
1024 { end_explicit_instantiation
(); }
1026 /* The TYPENAME expansions are to deal with use of a template class name as
1027 a template within the class itself, where the template decl is hidden by
1028 a type decl. Got all that? */
1031 PTYPENAME
'<' template_arg_list_opt template_close_bracket
1032 .finish_template_type
1034 | TYPENAME
'<' template_arg_list_opt template_close_bracket
1035 .finish_template_type
1037 | self_template_type
1040 apparent_template_type:
1042 | identifier
'<' template_arg_list_opt
'>'
1043 .finish_template_type
1047 SELFNAME
'<' template_arg_list_opt template_close_bracket
1048 .finish_template_type
1052 .finish_template_type
:
1054 if
(yychar == YYEMPTY
)
1057 $$
= finish_template_type
($
<ttype
>-3, $
<ttype
>-1,
1061 template_close_bracket:
1065 /* Handle `Class<Class<Type>>' without space in the `>>' */
1066 pedwarn
("`>>' should be `> >' in template class name");
1071 template_arg_list_opt:
1079 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1080 | template_arg_list
',' template_arg
1081 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1086 { $$
= groktypename
($1.t
); }
1090 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1091 $$
= TREE_TYPE
($$
);
1093 | global_scope PTYPENAME
1096 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1097 $$
= TREE_TYPE
($$
);
1099 | expr_no_comma_rangle
1100 | nested_name_specifier TEMPLATE identifier
1102 if
(!processing_template_decl
)
1104 cp_error
("use of template qualifier outside template");
1105 $$
= error_mark_node
;
1108 $$
= make_unbound_class_template
($1, $3, 1);
1114 { $$
= NEGATE_EXPR
; }
1116 { $$
= CONVERT_EXPR
; }
1118 { $$
= PREINCREMENT_EXPR
; }
1120 { $$
= PREDECREMENT_EXPR
; }
1122 { $$
= TRUTH_NOT_EXPR
; }
1127 { $$
= build_x_compound_expr
($$
); }
1133 { error ("ISO C++ forbids an empty condition for `%s'",
1135 $$
= integer_zero_node
; }
1142 { error ("ISO C++ forbids an empty condition for `%s'",
1144 $$
= integer_zero_node
; }
1158 type_specifier_seq declarator maybeasm maybe_attribute
'='
1161 for
(d
= getdecls
(); d
; d
= TREE_CHAIN
(d
))
1162 if
(TREE_CODE
(d
) == TYPE_DECL
) {
1163 tree s
= TREE_TYPE
(d
);
1164 if
(TREE_CODE
(s
) == RECORD_TYPE
)
1165 cp_error
("definition of class `%T' in condition", s
);
1166 else if
(TREE_CODE
(s
) == ENUMERAL_TYPE
)
1167 cp_error
("definition of enum `%T' in condition", s
);
1170 current_declspecs
= $1.t
;
1171 $
<ttype
>$
= parse_decl
($
<ttype
>2, $4, 1);
1175 parse_end_decl
($
<ttype
>6, $7, $4);
1176 $$
= convert_from_reference
($
<ttype
>6);
1177 if
(TREE_CODE
(TREE_TYPE
($$
)) == ARRAY_TYPE
)
1178 cp_error
("definition of array `%#D' in condition", $$
);
1185 | maybe_label_decls stmts
'}'
1186 | maybe_label_decls stmts
error '}'
1187 | maybe_label_decls
error '}'
1190 nontrivial_exprlist:
1191 expr_no_commas
',' expr_no_commas
1192 { $$
= tree_cons
(NULL_TREE
, $$
,
1193 build_tree_list
(NULL_TREE
, $3)); }
1194 | expr_no_commas
',' error
1195 { $$
= tree_cons
(NULL_TREE
, $$
,
1196 build_tree_list
(NULL_TREE
, error_mark_node
)); }
1197 | nontrivial_exprlist
',' expr_no_commas
1198 { chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1199 | nontrivial_exprlist
',' error
1200 { chainon
($$
, build_tree_list
(NULL_TREE
, error_mark_node
)); }
1205 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1206 | nontrivial_exprlist
1212 /* __extension__ turns off -pedantic for following primary. */
1213 | extension cast_expr %prec UNARY
1216 |
'*' cast_expr %prec UNARY
1217 { $$
= build_x_indirect_ref
($2, "unary *"); }
1218 |
'&' cast_expr %prec UNARY
1219 { $$
= build_x_unary_op
(ADDR_EXPR
, $2); }
1221 { $$
= build_x_unary_op
(BIT_NOT_EXPR
, $2); }
1222 | unop cast_expr %prec UNARY
1223 { $$
= finish_unary_op_expr
($1, $2); }
1224 /* Refer to the address of a label as a pointer. */
1226 { $$
= finish_label_address_expr
($2); }
1227 | SIZEOF unary_expr %prec UNARY
1228 { $$
= finish_sizeof
($2); }
1229 | SIZEOF
'(' type_id
')' %prec HYPERUNARY
1230 { $$
= finish_sizeof
(groktypename
($3.t
));
1231 check_for_new_type
("sizeof", $3); }
1232 | ALIGNOF unary_expr %prec UNARY
1233 { $$
= finish_alignof
($2); }
1234 | ALIGNOF
'(' type_id
')' %prec HYPERUNARY
1235 { $$
= finish_alignof
(groktypename
($3.t
));
1236 check_for_new_type
("alignof", $3); }
1238 /* The %prec EMPTY's here are required by the = init initializer
1239 syntax extension; see below. */
1240 | new new_type_id %prec EMPTY
1241 { $$
= build_new
(NULL_TREE
, $2.t
, NULL_TREE
, $1);
1242 check_for_new_type
("new", $2); }
1243 | new new_type_id new_initializer
1244 { $$
= build_new
(NULL_TREE
, $2.t
, $3, $1);
1245 check_for_new_type
("new", $2); }
1246 | new new_placement new_type_id %prec EMPTY
1247 { $$
= build_new
($2, $3.t
, NULL_TREE
, $1);
1248 check_for_new_type
("new", $3); }
1249 | new new_placement new_type_id new_initializer
1250 { $$
= build_new
($2, $3.t
, $4, $1);
1251 check_for_new_type
("new", $3); }
1252 | new
'(' type_id
')'
1254 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
),
1256 check_for_new_type
("new", $3); }
1257 | new
'(' type_id
')' new_initializer
1258 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
), $5, $1);
1259 check_for_new_type
("new", $3); }
1260 | new new_placement
'(' type_id
')' %prec EMPTY
1261 { $$
= build_new
($2, groktypename
($4.t
), NULL_TREE
, $1);
1262 check_for_new_type
("new", $4); }
1263 | new new_placement
'(' type_id
')' new_initializer
1264 { $$
= build_new
($2, groktypename
($4.t
), $6, $1);
1265 check_for_new_type
("new", $4); }
1267 | delete cast_expr %prec UNARY
1268 { $$
= delete_sanity
($2, NULL_TREE
, 0, $1); }
1269 | delete
'[' ']' cast_expr %prec UNARY
1270 { $$
= delete_sanity
($4, NULL_TREE
, 1, $1);
1271 if
(yychar == YYEMPTY
)
1273 | delete
'[' expr
']' cast_expr %prec UNARY
1274 { $$
= delete_sanity
($5, $3, 2, $1);
1275 if
(yychar == YYEMPTY
)
1277 | REALPART cast_expr %prec UNARY
1278 { $$
= build_x_unary_op
(REALPART_EXPR
, $2); }
1279 | IMAGPART cast_expr %prec UNARY
1280 { $$
= build_x_unary_op
(IMAGPART_EXPR
, $2); }
1284 '(' nonnull_exprlist
')'
1286 |
'{' nonnull_exprlist
'}'
1287 { cp_pedwarn
("old style placement syntax, use () instead");
1292 '(' nonnull_exprlist
')'
1295 { $$
= void_zero_node
; }
1298 cp_error
("`%T' is not a valid expression", $2.t
);
1299 $$
= error_mark_node
;
1301 /* GNU extension so people can use initializer lists. Note that
1302 this alters the meaning of `new int = 1', which was previously
1303 syntactically valid but semantically invalid.
1304 This feature is now deprecated and will be removed in a future
1309 pedwarn
("ISO C++ forbids initialization of new expression with `='");
1310 cp_deprecated
("new initializer lists extension");
1311 if
(TREE_CODE
($2) != TREE_LIST
1312 && TREE_CODE
($2) != CONSTRUCTOR
)
1313 $$
= build_tree_list
(NULL_TREE
, $2);
1319 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1321 '(' type_id
')' %prec EMPTY
1322 { $2.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $2.t
), 0);
1323 $$
= make_call_declarator
(NULL_TREE
, $2.t
, NULL_TREE
, NULL_TREE
);
1324 check_for_new_type
("cast", $2); }
1325 | regcast_or_absdcl
'(' type_id
')' %prec EMPTY
1326 { $3.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $3.t
), 0);
1327 $$
= make_call_declarator
($$
, $3.t
, NULL_TREE
, NULL_TREE
);
1328 check_for_new_type
("cast", $3); }
1333 | regcast_or_absdcl unary_expr %prec UNARY
1334 { $$
= reparse_absdcl_as_casts
($$
, $2); }
1335 | regcast_or_absdcl
'{' initlist maybecomma
'}' %prec UNARY
1337 tree init
= build_nt
(CONSTRUCTOR
, NULL_TREE
,
1340 pedwarn
("ISO C++ forbids compound literals");
1341 /* Indicate that this was a C99 compound literal. */
1342 TREE_HAS_CONSTRUCTOR
(init
) = 1;
1344 $$
= reparse_absdcl_as_casts
($$
, init
);
1350 /* Handle general members. */
1351 | expr_no_commas POINTSAT_STAR expr_no_commas
1352 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1353 | expr_no_commas DOT_STAR expr_no_commas
1354 { $$
= build_m_component_ref
($$
, $3); }
1355 | expr_no_commas
'+' expr_no_commas
1356 { $$
= build_x_binary_op
($2, $$
, $3); }
1357 | expr_no_commas
'-' expr_no_commas
1358 { $$
= build_x_binary_op
($2, $$
, $3); }
1359 | expr_no_commas
'*' expr_no_commas
1360 { $$
= build_x_binary_op
($2, $$
, $3); }
1361 | expr_no_commas
'/' expr_no_commas
1362 { $$
= build_x_binary_op
($2, $$
, $3); }
1363 | expr_no_commas
'%' expr_no_commas
1364 { $$
= build_x_binary_op
($2, $$
, $3); }
1365 | expr_no_commas LSHIFT expr_no_commas
1366 { $$
= build_x_binary_op
($2, $$
, $3); }
1367 | expr_no_commas RSHIFT expr_no_commas
1368 { $$
= build_x_binary_op
($2, $$
, $3); }
1369 | expr_no_commas ARITHCOMPARE expr_no_commas
1370 { $$
= build_x_binary_op
($2, $$
, $3); }
1371 | expr_no_commas
'<' expr_no_commas
1372 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1373 | expr_no_commas
'>' expr_no_commas
1374 { $$
= build_x_binary_op
(GT_EXPR
, $$
, $3); }
1375 | expr_no_commas EQCOMPARE expr_no_commas
1376 { $$
= build_x_binary_op
($2, $$
, $3); }
1377 | expr_no_commas MIN_MAX expr_no_commas
1378 { $$
= build_x_binary_op
($2, $$
, $3); }
1379 | expr_no_commas
'&' expr_no_commas
1380 { $$
= build_x_binary_op
($2, $$
, $3); }
1381 | expr_no_commas
'|' expr_no_commas
1382 { $$
= build_x_binary_op
($2, $$
, $3); }
1383 | expr_no_commas
'^' expr_no_commas
1384 { $$
= build_x_binary_op
($2, $$
, $3); }
1385 | expr_no_commas ANDAND expr_no_commas
1386 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1387 | expr_no_commas OROR expr_no_commas
1388 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1389 | expr_no_commas
'?' xexpr
':' expr_no_commas
1390 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1391 | expr_no_commas
'=' expr_no_commas
1392 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1393 if
($$
!= error_mark_node
)
1394 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1395 | expr_no_commas ASSIGN expr_no_commas
1396 { $$
= build_x_modify_expr
($$
, $2, $3); }
1398 { $$
= build_throw
(NULL_TREE
); }
1399 | THROW expr_no_commas
1400 { $$
= build_throw
($2); }
1403 expr_no_comma_rangle:
1405 /* Handle general members. */
1406 | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
1407 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1408 | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
1409 { $$
= build_m_component_ref
($$
, $3); }
1410 | expr_no_comma_rangle
'+' expr_no_comma_rangle
1411 { $$
= build_x_binary_op
($2, $$
, $3); }
1412 | expr_no_comma_rangle
'-' expr_no_comma_rangle
1413 { $$
= build_x_binary_op
($2, $$
, $3); }
1414 | expr_no_comma_rangle
'*' expr_no_comma_rangle
1415 { $$
= build_x_binary_op
($2, $$
, $3); }
1416 | expr_no_comma_rangle
'/' expr_no_comma_rangle
1417 { $$
= build_x_binary_op
($2, $$
, $3); }
1418 | expr_no_comma_rangle
'%' expr_no_comma_rangle
1419 { $$
= build_x_binary_op
($2, $$
, $3); }
1420 | expr_no_comma_rangle LSHIFT expr_no_comma_rangle
1421 { $$
= build_x_binary_op
($2, $$
, $3); }
1422 | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
1423 { $$
= build_x_binary_op
($2, $$
, $3); }
1424 | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
1425 { $$
= build_x_binary_op
($2, $$
, $3); }
1426 | expr_no_comma_rangle
'<' expr_no_comma_rangle
1427 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1428 | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
1429 { $$
= build_x_binary_op
($2, $$
, $3); }
1430 | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
1431 { $$
= build_x_binary_op
($2, $$
, $3); }
1432 | expr_no_comma_rangle
'&' expr_no_comma_rangle
1433 { $$
= build_x_binary_op
($2, $$
, $3); }
1434 | expr_no_comma_rangle
'|' expr_no_comma_rangle
1435 { $$
= build_x_binary_op
($2, $$
, $3); }
1436 | expr_no_comma_rangle
'^' expr_no_comma_rangle
1437 { $$
= build_x_binary_op
($2, $$
, $3); }
1438 | expr_no_comma_rangle ANDAND expr_no_comma_rangle
1439 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1440 | expr_no_comma_rangle OROR expr_no_comma_rangle
1441 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1442 | expr_no_comma_rangle
'?' xexpr
':' expr_no_comma_rangle
1443 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1444 | expr_no_comma_rangle
'=' expr_no_comma_rangle
1445 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1446 if
($$
!= error_mark_node
)
1447 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1448 | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
1449 { $$
= build_x_modify_expr
($$
, $2, $3); }
1451 { $$
= build_throw
(NULL_TREE
); }
1452 | THROW expr_no_comma_rangle
1453 { $$
= build_throw
($2); }
1456 notype_unqualified_id:
1457 '~' see_typename identifier
1458 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1459 |
'~' see_typename template_type
1460 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1465 | NSNAME %prec EMPTY
1470 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1471 means that we're in an expression like S::f<int>, so
1472 don't do_identifier; we only do that for unqualified
1474 if
(!lastiddecl || TREE_CODE
(lastiddecl
) != TREE_LIST
)
1475 $$
= do_identifier
($
<ttype
>-1, 1, NULL_TREE
);
1481 PFUNCNAME
'<' do_id template_arg_list_opt template_close_bracket
1482 { $$
= lookup_template_function
($3, $4); }
1483 | operator_name
'<' do_id template_arg_list_opt template_close_bracket
1484 { $$
= lookup_template_function
($3, $4); }
1488 TEMPLATE identifier
'<' template_arg_list_opt template_close_bracket
1489 { $$
= lookup_template_function
($2, $4); }
1490 | TEMPLATE PFUNCNAME
'<' template_arg_list_opt template_close_bracket
1491 { $$
= lookup_template_function
($2, $4); }
1492 | TEMPLATE operator_name
'<' template_arg_list_opt
1493 template_close_bracket
1494 { $$
= lookup_template_function
($2, $4); }
1498 notype_unqualified_id
1503 expr_or_declarator_intern:
1505 | attributes expr_or_declarator
1507 /* Provide support for '(' attributes '*' declarator ')'
1509 $$
= tree_cons
($1, $2, NULL_TREE
);
1514 notype_unqualified_id
1515 |
'*' expr_or_declarator_intern %prec UNARY
1516 { $$
= build_nt
(INDIRECT_REF
, $2); }
1517 |
'&' expr_or_declarator_intern %prec UNARY
1518 { $$
= build_nt
(ADDR_EXPR
, $2); }
1519 |
'(' expr_or_declarator_intern
')'
1523 notype_template_declarator:
1524 IDENTIFIER
'<' template_arg_list_opt template_close_bracket
1525 { $$
= lookup_template_function
($1, $3); }
1526 | NSNAME
'<' template_arg_list template_close_bracket
1527 { $$
= lookup_template_function
($1, $3); }
1530 direct_notype_declarator:
1531 complex_direct_notype_declarator
1532 /* This precedence declaration is to prefer this reduce
1533 to the Koenig lookup shift in primary, below. I hate yacc. */
1534 | notype_unqualified_id %prec
'('
1535 | notype_template_declarator
1536 |
'(' expr_or_declarator_intern
')'
1537 { $$
= finish_decl_parsing
($2); }
1541 notype_unqualified_id
1543 if
(TREE_CODE
($1) == BIT_NOT_EXPR
)
1544 $$
= build_x_unary_op
(BIT_NOT_EXPR
, TREE_OPERAND
($1, 0));
1546 $$
= finish_id_expr
($1);
1552 $$
= combine_strings
($$
);
1553 /* combine_strings doesn't set up TYPE_MAIN_VARIANT of
1554 a const array the way we want, so fix it. */
1555 if
(flag_const_strings
)
1556 TREE_TYPE
($$
) = build_cplus_array_type
1557 (TREE_TYPE
(TREE_TYPE
($$
)),
1558 TYPE_DOMAIN
(TREE_TYPE
($$
)));
1562 $$
= fname_decl
(C_RID_CODE
($$
), $$
);
1563 if
(processing_template_decl
)
1564 $$
= build_min_nt
(LOOKUP_EXPR
, DECL_NAME
($$
));
1567 { $$
= finish_parenthesized_expr
($2); }
1568 |
'(' expr_or_declarator_intern
')'
1569 { $2 = reparse_decl_as_expr
(NULL_TREE
, $2);
1570 $$
= finish_parenthesized_expr
($2); }
1572 { $$
= error_mark_node
; }
1574 { tree scope
= current_scope
();
1575 if
(!scope || TREE_CODE
(scope
) != FUNCTION_DECL
)
1577 error ("braced-group within expression allowed only inside a function");
1581 pedwarn
("ISO C++ forbids braced-groups within expressions");
1582 $
<ttype
>$
= begin_stmt_expr
();
1585 { $$
= finish_stmt_expr
($
<ttype
>2); }
1586 /* Koenig lookup support
1587 We could store lastiddecl in $1 to avoid another lookup,
1588 but that would result in many additional reduce/reduce conflicts. */
1589 | notype_unqualified_id
'(' nonnull_exprlist
')'
1590 { $$
= finish_call_expr
($1, $3, 1); }
1591 | notype_unqualified_id LEFT_RIGHT
1592 { $$
= finish_call_expr
($1, NULL_TREE
, 1); }
1593 | primary
'(' nonnull_exprlist
')'
1594 { $$
= finish_call_expr
($1, $3, 0); }
1595 | primary LEFT_RIGHT
1596 { $$
= finish_call_expr
($1, NULL_TREE
, 0); }
1597 | VA_ARG
'(' expr_no_commas
',' type_id
')'
1598 { $$
= build_x_va_arg
($3, groktypename
($5.t
));
1599 check_for_new_type
("__builtin_va_arg", $5); }
1600 | primary
'[' expr
']'
1601 { $$
= grok_array_decl
($$
, $3); }
1603 { $$
= finish_increment_expr
($1, POSTINCREMENT_EXPR
); }
1604 | primary MINUSMINUS
1605 { $$
= finish_increment_expr
($1, POSTDECREMENT_EXPR
); }
1606 /* C++ extensions */
1608 { $$
= finish_this_expr
(); }
1609 | CV_QUALIFIER
'(' nonnull_exprlist
')'
1611 /* This is a C cast in C++'s `functional' notation
1612 using the "implicit int" extension so that:
1613 `const (3)' is equivalent to `const int (3)'. */
1616 type
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1617 type
= groktypename
(build_tree_list
(type
, NULL_TREE
));
1618 $$
= build_functional_cast
(type
, $3);
1621 | DYNAMIC_CAST
'<' type_id
'>' '(' expr
')'
1622 { tree type
= groktypename
($3.t
);
1623 check_for_new_type
("dynamic_cast", $3);
1624 $$
= build_dynamic_cast
(type
, $6); }
1625 | STATIC_CAST
'<' type_id
'>' '(' expr
')'
1626 { tree type
= groktypename
($3.t
);
1627 check_for_new_type
("static_cast", $3);
1628 $$
= build_static_cast
(type
, $6); }
1629 | REINTERPRET_CAST
'<' type_id
'>' '(' expr
')'
1630 { tree type
= groktypename
($3.t
);
1631 check_for_new_type
("reinterpret_cast", $3);
1632 $$
= build_reinterpret_cast
(type
, $6); }
1633 | CONST_CAST
'<' type_id
'>' '(' expr
')'
1634 { tree type
= groktypename
($3.t
);
1635 check_for_new_type
("const_cast", $3);
1636 $$
= build_const_cast
(type
, $6); }
1637 | TYPEID
'(' expr
')'
1638 { $$
= build_typeid
($3); }
1639 | TYPEID
'(' type_id
')'
1640 { tree type
= groktypename
($3.t
);
1641 check_for_new_type
("typeid", $3);
1642 $$
= get_typeid
(TYPE_MAIN_VARIANT
(type
)); }
1643 | global_scope IDENTIFIER
1644 { $$
= do_scoped_id
($2, 1); }
1645 | global_scope template_id
1647 | global_scope operator_name
1649 got_scope
= NULL_TREE
;
1650 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
1651 $$
= do_scoped_id
($2, 1);
1655 | overqualified_id %prec HYPERUNARY
1656 { $$
= build_offset_ref
(OP0
($$
), OP1
($$
)); }
1657 | overqualified_id
'(' nonnull_exprlist
')'
1658 { $$
= finish_qualified_call_expr
($1, $3); }
1659 | overqualified_id LEFT_RIGHT
1660 { $$
= finish_qualified_call_expr
($1, NULL_TREE
); }
1661 | object object_template_id %prec UNARY
1663 $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1);
1665 | object object_template_id
'(' nonnull_exprlist
')'
1666 { $$
= finish_object_call_expr
($2, $1, $4); }
1667 | object object_template_id LEFT_RIGHT
1668 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1669 | object unqualified_id %prec UNARY
1670 { $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1); }
1671 | object overqualified_id %prec UNARY
1672 { if
(processing_template_decl
)
1673 $$
= build_min_nt
(COMPONENT_REF
, $1, $2);
1675 $$
= build_object_ref
($$
, OP0
($2), OP1
($2)); }
1676 | object unqualified_id
'(' nonnull_exprlist
')'
1677 { $$
= finish_object_call_expr
($2, $1, $4); }
1678 | object unqualified_id LEFT_RIGHT
1679 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1680 | object overqualified_id
'(' nonnull_exprlist
')'
1681 { $$
= finish_qualified_object_call_expr
($2, $1, $4); }
1682 | object overqualified_id LEFT_RIGHT
1683 { $$
= finish_qualified_object_call_expr
($2, $1, NULL_TREE
); }
1684 /* p->int::~int() is valid -- 12.4 */
1685 | object
'~' TYPESPEC LEFT_RIGHT
1686 { $$
= finish_pseudo_destructor_call_expr
($1, NULL_TREE
, $3); }
1687 | object TYPESPEC SCOPE
'~' TYPESPEC LEFT_RIGHT
1688 { $$
= finish_pseudo_destructor_call_expr
($1, $2, $5); }
1691 $$
= error_mark_node
;
1695 /* Not needed for now.
1701 { $$ = error_mark_node; }
1703 { if (current_function_decl == 0)
1705 error ("braced-group within expression allowed only inside a function");
1708 $<ttype>$ = expand_start_stmt_expr (); }
1711 pedwarn ("ISO C++ forbids braced-groups within expressions");
1712 $$ = expand_end_stmt_expr ($<ttype>2); }
1713 | primary_no_id '(' nonnull_exprlist ')'
1714 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1715 | primary_no_id LEFT_RIGHT
1716 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1717 | primary_no_id '[' expr ']'
1719 | primary_no_id PLUSPLUS
1720 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1721 | primary_no_id MINUSMINUS
1722 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1724 { goto do_scoped_id; }
1725 | SCOPE operator_name
1726 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1728 goto do_scoped_operator;
1737 { got_scope
= NULL_TREE
; $$
= 1; }
1743 | global_scope delete
1744 { got_scope
= NULL_TREE
; $$
= 1; }
1749 { $$
= boolean_true_node
; }
1751 { $$
= boolean_false_node
; }
1754 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1758 { $$
= chainon
($$
, $2); }
1764 setup_vtbl_ptr
(NULL_TREE
, NULL_TREE
);
1770 { got_object
= TREE_TYPE
($$
); }
1773 $$
= build_x_arrow
($$
);
1774 got_object
= TREE_TYPE
($$
);
1779 typespec initdecls
';'
1781 if
($1.t
&& IS_AGGR_TYPE_CODE
(TREE_CODE
($1.t
)))
1782 note_got_semicolon
($1.t
);
1784 | typed_declspecs initdecls
';'
1786 note_list_got_semicolon
($1.t
);
1788 | declmods notype_initdecls
';'
1790 | typed_declspecs
';'
1793 note_list_got_semicolon
($1.t
);
1796 { warning
("empty declaration"); }
1801 /* Any kind of declarator (thus, all declarators allowed
1802 after an explicit typespec). */
1805 after_type_declarator %prec EMPTY
1806 | notype_declarator %prec EMPTY
1809 /* This is necessary to postpone reduction of `int()()()()'. */
1811 LEFT_RIGHT %prec EMPTY
1812 { $$
= make_call_declarator
(NULL_TREE
, empty_parms
(),
1813 NULL_TREE
, NULL_TREE
); }
1814 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1815 { $$
= make_call_declarator
($$
, empty_parms
(), NULL_TREE
,
1819 /* ISO type-id (8.1) */
1821 typed_typespecs absdcl
1822 { $$.t
= build_tree_list
($1.t
, $2);
1823 $$.new_type_flag
= $1.new_type_flag
; }
1824 | nonempty_cv_qualifiers absdcl
1825 { $$.t
= build_tree_list
($1.t
, $2);
1826 $$.new_type_flag
= $1.new_type_flag
; }
1828 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
1830 $$.new_type_flag
= $1.new_type_flag
; }
1831 | typed_typespecs %prec EMPTY
1832 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1833 $$.new_type_flag
= $1.new_type_flag
; }
1834 | nonempty_cv_qualifiers %prec EMPTY
1835 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1836 $$.new_type_flag
= $1.new_type_flag
; }
1839 /* Declspecs which contain at least one type specifier or typedef name.
1840 (Just `const' or `volatile' is not enough.)
1841 A typedef'd name following these is taken as a name to be declared.
1842 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1845 typed_typespecs %prec EMPTY
1846 { $$.lookups
= type_lookups
; }
1848 { $$.lookups
= type_lookups
; }
1853 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1854 $$.new_type_flag
= $2.new_type_flag
; }
1855 | typespec reserved_declspecs %prec HYPERUNARY
1856 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1857 $$.new_type_flag
= $1.new_type_flag
; }
1858 | typespec reserved_typespecquals reserved_declspecs
1859 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, chainon
($2, $3));
1860 $$.new_type_flag
= $1.new_type_flag
; }
1861 | declmods typespec reserved_declspecs
1862 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1863 $$.new_type_flag
= $2.new_type_flag
; }
1864 | declmods typespec reserved_typespecquals
1865 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1866 $$.new_type_flag
= $2.new_type_flag
; }
1867 | declmods typespec reserved_typespecquals reserved_declspecs
1868 { $$.t
= tree_cons
(NULL_TREE
, $2.t
,
1869 chainon
($3, chainon
($4, $1.t
)));
1870 $$.new_type_flag
= $2.new_type_flag
; }
1875 { if
(extra_warnings
)
1876 warning
("`%s' is not at beginning of declaration",
1877 IDENTIFIER_POINTER
($$
));
1878 $$
= build_tree_list
(NULL_TREE
, $$
); }
1879 | reserved_declspecs typespecqual_reserved
1880 { $$
= tree_cons
(NULL_TREE
, $2.t
, $$
); }
1881 | reserved_declspecs SCSPEC
1882 { if
(extra_warnings
)
1883 warning
("`%s' is not at beginning of declaration",
1884 IDENTIFIER_POINTER
($2));
1885 $$
= tree_cons
(NULL_TREE
, $2, $$
); }
1886 | reserved_declspecs attributes
1887 { $$
= tree_cons
($2, NULL_TREE
, $1); }
1889 { $$
= tree_cons
($1, NULL_TREE
, NULL_TREE
); }
1892 /* List of just storage classes and type modifiers.
1893 A declaration can start with just this, but then it cannot be used
1894 to redeclare a typedef-name.
1895 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1897 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1898 up on a persistent obstack. Otherwise, they could appear at the
1899 beginning of something like
1901 static const struct { int foo () { } } b;
1903 and would be discarded after we finish compiling foo. We don't need to
1904 worry once we see a type. */
1907 nonempty_cv_qualifiers %prec EMPTY
1908 { $$.lookups
= NULL_TREE
; TREE_STATIC
($$.t
) = 1; }
1911 $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1912 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1914 | declmods CV_QUALIFIER
1916 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1917 TREE_STATIC
($$.t
) = 1;
1921 if
(extra_warnings
&& TREE_STATIC
($$.t
))
1922 warning
("`%s' is not at beginning of declaration",
1923 IDENTIFIER_POINTER
($2));
1924 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1925 TREE_STATIC
($$.t
) = TREE_STATIC
($1.t
);
1927 | declmods attributes
1928 { $$.t
= hash_tree_cons
($2, NULL_TREE
, $1.t
); }
1929 | attributes %prec EMPTY
1931 $$.t
= hash_tree_cons
($1, NULL_TREE
, NULL_TREE
);
1932 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1936 /* Used instead of declspecs where storage classes are not allowed
1937 (that is, for typenames and structure components).
1939 C++ can takes storage classes for structure components.
1940 Don't accept a typedef-name if anything but a modifier precedes it. */
1943 typespec %prec EMPTY
1944 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
1945 $$.new_type_flag
= $1.new_type_flag
; }
1946 | nonempty_cv_qualifiers typespec
1947 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1948 $$.new_type_flag
= $2.new_type_flag
; }
1949 | typespec reserved_typespecquals
1950 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1951 $$.new_type_flag
= $1.new_type_flag
; }
1952 | nonempty_cv_qualifiers typespec reserved_typespecquals
1953 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1954 $$.new_type_flag
= $2.new_type_flag
; }
1957 reserved_typespecquals:
1958 typespecqual_reserved
1959 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
1960 | reserved_typespecquals typespecqual_reserved
1961 { $$
= tree_cons
(NULL_TREE
, $2.t
, $1); }
1964 /* A typespec (but not a type qualifier).
1965 Once we have seen one of these in a declaration,
1966 if a typedef name appears then it is being redeclared. */
1970 { $$.lookups
= NULL_TREE
; }
1971 | TYPESPEC %prec EMPTY
1972 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1973 | complete_type_name
1974 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1975 | TYPEOF
'(' expr
')'
1976 { $$.t
= finish_typeof
($3);
1977 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1978 | TYPEOF
'(' type_id
')'
1979 { $$.t
= groktypename
($3.t
);
1980 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1981 | SIGOF
'(' expr
')'
1982 { tree type
= TREE_TYPE
($3);
1984 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1985 if
(IS_AGGR_TYPE
(type
))
1987 sorry
("sigof type specifier");
1992 error ("`sigof' applied to non-aggregate expression");
1993 $$.t
= error_mark_node
;
1996 | SIGOF
'(' type_id
')'
1997 { tree type
= groktypename
($3.t
);
1999 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2000 if
(IS_AGGR_TYPE
(type
))
2002 sorry
("sigof type specifier");
2007 error("`sigof' applied to non-aggregate type");
2008 $$.t
= error_mark_node
;
2013 /* A typespec that is a reserved word, or a type qualifier. */
2015 typespecqual_reserved:
2017 { $$.t
= $1; $$.new_type_flag
= 0; }
2019 { $$.t
= $1; $$.new_type_flag
= 0; }
2025 | initdecls
',' initdcl
2026 { check_multiple_declarators
(); }
2031 | notype_initdecls
',' initdcl
2032 { check_multiple_declarators
(); }
2037 | nomods_initdecls
',' initdcl
2038 { check_multiple_declarators
(); }
2044 | asm_keyword
'(' string ')'
2045 { if
(TREE_CHAIN
($3)) $3 = combine_strings
($3); $$
= $3; }
2049 declarator maybeasm maybe_attribute
'='
2050 { $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 1); }
2052 /* Note how the declaration of the variable is in effect while its init is parsed! */
2053 { parse_end_decl
($
<ttype
>5, $6, $2); }
2054 | declarator maybeasm maybe_attribute
2056 $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 0);
2057 parse_end_decl
($
<ttype
>$
, NULL_TREE
, $2);
2061 /* This rule assumes a certain configuration of the parser stack.
2062 In particular, $0, the element directly before the beginning of
2063 this rule on the stack, must be a maybeasm. $-1 must be a
2064 declarator or notype_declarator. And $-2 must be some declmods
2065 or declspecs. We can't move the maybeasm into this rule because
2066 we need that reduce so we prefer fn.def1 when appropriate. */
2069 { $
<ttype
>$
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2070 $
<ftype
>-2.lookups
, $1, 1); }
2071 /* Note how the declaration of the variable is in effect
2072 while its init is parsed! */
2074 { parse_end_decl
($
<ttype
>3, $4, $
<ttype
>0); }
2076 { tree d
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2077 $
<ftype
>-2.lookups
, $1, 0);
2078 parse_end_decl
(d
, NULL_TREE
, $
<ttype
>0); }
2082 declarator maybeasm initdcl0_innards
2087 notype_declarator maybeasm initdcl0_innards
2092 notype_declarator maybeasm
2093 { /* Set things up as initdcl0_innards expects. */
2096 $
<ftype
>1.t
= NULL_TREE
;
2097 $
<ftype
>1.lookups
= NULL_TREE
; }
2100 | constructor_declarator maybeasm maybe_attribute
2101 { tree d
= parse_decl0
($1, NULL_TREE
, NULL_TREE
, $3, 0);
2102 parse_end_decl
(d
, NULL_TREE
, $2); }
2105 /* the * rules are dummies to accept the Apollo extended syntax
2106 so that the header files compile. */
2117 | attributes attribute
2118 { $$
= chainon
($1, $2); }
2122 ATTRIBUTE
'(' '(' attribute_list
')' ')'
2129 | attribute_list
',' attrib
2130 { $$
= chainon
($1, $3); }
2137 { $$
= build_tree_list
($1, NULL_TREE
); }
2138 | any_word
'(' IDENTIFIER
')'
2139 { $$
= build_tree_list
($1, build_tree_list
(NULL_TREE
, $3)); }
2140 | any_word
'(' IDENTIFIER
',' nonnull_exprlist
')'
2141 { $$
= build_tree_list
($1, tree_cons
(NULL_TREE
, $3, $5)); }
2142 | any_word
'(' nonnull_exprlist
')'
2143 { $$
= build_tree_list
($1, $3); }
2146 /* This still leaves out most reserved keywords,
2147 shouldn't we include them? */
2156 /* A nonempty list of identifiers, including typenames. */
2157 identifiers_or_typenames:
2159 { $$
= build_tree_list
(NULL_TREE
, $1); }
2160 | identifiers_or_typenames
',' identifier
2161 { $$
= chainon
($1, build_tree_list
(NULL_TREE
, $3)); }
2165 /* empty */ %prec EMPTY
2170 /* If we are processing a template, we don't want to expand this
2174 expr_no_commas %prec
'='
2176 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, NULL_TREE
);
2177 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2179 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2180 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2181 |
'{' initlist
',' '}'
2182 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2183 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2188 /* This chain is built in reverse order,
2189 and put in forward order where initlist is used. */
2192 { $$
= build_tree_list
(NULL_TREE
, $$
); }
2194 { $$
= tree_cons
(NULL_TREE
, $3, $$
); }
2195 /* These are for labeled elements. */
2196 |
'[' expr_no_commas
']' init
2197 { $$
= build_tree_list
($2, $4); }
2198 | identifier
':' init
2199 { $$
= build_tree_list
($$
, $3); }
2200 | initlist
',' identifier
':' init
2201 { $$
= tree_cons
($3, $5, $$
); }
2205 PRE_PARSED_FUNCTION_DECL maybe_return_init ctor_initializer_opt compstmt_or_error
2207 expand_body
(finish_function
((int)$3 |
2));
2208 process_next_inline
($1);
2210 | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
2212 expand_body
(finish_function
((int)$3 |
2));
2213 process_next_inline
($1);
2215 | PRE_PARSED_FUNCTION_DECL maybe_return_init
error
2217 finish_function
(2);
2218 process_next_inline
($1); }
2223 | pending_inlines pending_inline eat_saved_input
2226 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2227 the TREE_LIST node for the parameter in question. */
2229 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2230 { replace_defarg
($1, $2); }
2231 | DEFARG_MARKER
error END_OF_SAVED_INPUT
2232 { replace_defarg
($1, error_mark_node
); }
2235 /* empty */ %prec EMPTY
2236 | pending_defargs defarg_again
2237 { do_pending_defargs
(); }
2238 | pending_defargs
error
2239 { do_pending_defargs
(); }
2244 { $
<ttype
>$
= current_enum_type
;
2245 current_enum_type
= start_enum
($2); }
2247 { $$.t
= current_enum_type
;
2248 finish_enum
(current_enum_type
);
2249 $$.new_type_flag
= 1;
2250 current_enum_type
= $
<ttype
>4;
2251 check_for_missing_semicolon
($$.t
); }
2253 { $
<ttype
>$
= current_enum_type
;
2254 current_enum_type
= start_enum
(make_anon_name
()); }
2256 { $$.t
= current_enum_type
;
2257 finish_enum
(current_enum_type
);
2258 $$.new_type_flag
= 1;
2259 current_enum_type
= $
<ttype
>3;
2260 check_for_missing_semicolon
($$.t
); }
2262 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2263 $$.new_type_flag
= 0; }
2264 | ENUM complex_type_name
2265 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2266 $$.new_type_flag
= 0; }
2267 | TYPENAME_KEYWORD typename_sub
2269 $$.new_type_flag
= 0;
2270 if
(!processing_template_decl
)
2271 cp_pedwarn
("using `typename' outside of template"); }
2272 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2274 { $1.t
= begin_class_definition
($1.t
);
2275 current_aggr
= NULL_TREE
; }
2276 opt.component_decl_list
'}' maybe_attribute
2281 if
(yychar == YYEMPTY
)
2283 semi
= yychar == ';';
2285 t
= finish_class_definition
($1.t
, $6, semi
,
2289 /* restore current_aggr */
2290 current_aggr
= TREE_CODE
(t
) != RECORD_TYPE
2292 : CLASSTYPE_DECLARED_CLASS
(t
)
2293 ? class_type_node
: record_type_node
;
2297 done_pending_defargs
();
2298 begin_inline_definitions
();
2302 finish_inline_definitions
();
2304 $$.new_type_flag
= 1;
2306 | class_head %prec EMPTY
2308 if
($1.new_type_flag
&& $1.t
!= error_mark_node
)
2309 pop_scope
(CP_DECL_CONTEXT
(TYPE_MAIN_DECL
($1.t
)));
2310 $$.new_type_flag
= 0;
2311 if
($1.t
== error_mark_node
)
2313 else if
(TYPE_BINFO
($1.t
) == NULL_TREE
)
2315 cp_error
("%T is not a class type", $1.t
);
2316 $$.t
= error_mark_node
;
2321 /* struct B: public A; is not accepted by the standard grammar. */
2322 if
(CLASS_TYPE_P
($$.t
)
2323 && TYPE_BINFO_BASETYPES
($$.t
)
2324 && !COMPLETE_TYPE_P
($$.t
)
2325 && ! TYPE_BEING_DEFINED
($$.t
))
2326 cp_error
("base clause without member specification for `%#T'",
2340 { if
(pedantic
&& !in_system_header
)
2341 pedwarn
("comma at end of enumerator list"); }
2347 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2349 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2351 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2353 { error ("no body nor ';' separates two class, struct or union declarations"); }
2355 { $$
= build_tree_list
($2, $1); }
2358 named_class_head_sans_basetype:
2366 named_class_head_sans_basetype_defn:
2367 aggr identifier_defn %prec EMPTY
2368 { current_aggr
= $$
; $$
= $2; }
2369 | named_class_head_sans_basetype
'{'
2370 { yyungetc
('{', 1); }
2371 | named_class_head_sans_basetype
':'
2372 { yyungetc
(':', 1); }
2375 named_complex_class_head_sans_basetype:
2376 aggr nested_name_specifier identifier
2379 $$.t
= handle_class_head
($1, $2, $3);
2380 $$.new_type_flag
= 1;
2382 | aggr global_scope nested_name_specifier identifier
2385 $$.t
= handle_class_head
($1, $3, $4);
2386 $$.new_type_flag
= 1;
2388 | aggr global_scope identifier
2391 $$.t
= handle_class_head
($1, NULL_TREE
, $3);
2392 $$.new_type_flag
= 1;
2394 | aggr apparent_template_type
2398 $$.new_type_flag
= 0;
2400 | aggr nested_name_specifier apparent_template_type
2404 push_scope
(CP_DECL_CONTEXT
($$.t
));
2405 $$.new_type_flag
= 1;
2410 named_class_head_sans_basetype %prec EMPTY
2412 $$.t
= xref_tag
(current_aggr
, $1, 1);
2413 $$.new_type_flag
= 0;
2415 | named_class_head_sans_basetype_defn
2416 { $
<ttype
>$
= xref_tag
(current_aggr
, $1, 0); }
2417 /* Class name is unqualified, so we look for base classes
2418 in the current scope. */
2419 maybe_base_class_list %prec EMPTY
2422 $$.new_type_flag
= 0;
2424 xref_basetypes
(current_aggr
, $1, $
<ttype
>2, $3);
2426 | named_complex_class_head_sans_basetype
2427 maybe_base_class_list
2429 if
($1.t
!= error_mark_node
)
2431 tree type
= TREE_TYPE
($1.t
);
2434 $$.new_type_flag
= $1.new_type_flag
;
2435 if
((current_aggr
== union_type_node
)
2436 != (TREE_CODE
(type
) == UNION_TYPE
))
2437 cp_pedwarn
(current_aggr
== union_type_node
2438 ?
"`union' tag used in declaring `%#T'"
2439 : "non-`union' tag used in declaring `%#T'",
2441 else if
(TREE_CODE
(type
) == RECORD_TYPE
)
2442 /* We might be specializing a template with a different
2444 CLASSTYPE_DECLARED_CLASS
(type
)
2445 = (current_aggr
== class_type_node
);
2448 if
(TREE_CODE
(type
) == TYPENAME_TYPE
)
2449 /* In a definition of a member class template, we
2450 will get here with an implicit typename, a
2451 TYPENAME_TYPE with a type. */
2452 type
= TREE_TYPE
(type
);
2453 maybe_process_partial_specialization
(type
);
2454 xref_basetypes
(current_aggr
, $1.t
, type
, $2);
2462 { $$
= xref_tag
($$
, make_anon_name
(), 0);
2463 yyungetc
('{', 1); }
2466 /* The tree output of this nonterminal a declarationf or the type
2467 named. If NEW_TYPE_FLAG is set, then the name used in this
2468 class-head was explicitly qualified, e.g.: `struct X::Y'. We have
2469 already called push_scope for X. */
2474 $$.new_type_flag
= 0;
2479 maybe_base_class_list:
2480 /* empty */ %prec EMPTY
2482 |
':' see_typename %prec EMPTY
2483 { yyungetc
(':', 1); $$
= NULL_TREE
; }
2484 |
':' see_typename base_class_list %prec EMPTY
2490 | base_class_list
',' see_typename base_class
2491 { $$
= chainon
($$
, $4); }
2496 { $$
= finish_base_specifier
(access_default_node
, $1); }
2497 | base_class_access_list see_typename base_class
.1
2498 { $$
= finish_base_specifier
($1, $3); }
2504 $$
= error_mark_node
; }
2506 { $$
= TREE_TYPE
($$
); }
2509 base_class_access_list:
2510 VISSPEC see_typename
2511 | SCSPEC see_typename
2512 { if
($1 != ridpointers
[(int)RID_VIRTUAL
])
2513 cp_error
("`%D' access", $1);
2514 $$
= access_default_virtual_node
; }
2515 | base_class_access_list VISSPEC see_typename
2517 if
($1 != access_default_virtual_node
)
2518 error ("multiple access specifiers");
2519 else if
($2 == access_public_node
)
2520 $$
= access_public_virtual_node
;
2521 else if
($2 == access_protected_node
)
2522 $$
= access_protected_virtual_node
;
2523 else
/* $2 == access_private_node */
2524 $$
= access_private_virtual_node
;
2526 | base_class_access_list SCSPEC see_typename
2527 { if
($2 != ridpointers
[(int)RID_VIRTUAL
])
2528 cp_error
("`%D' access", $2);
2529 else if
($$
== access_public_node
)
2530 $$
= access_public_virtual_node
;
2531 else if
($$
== access_protected_node
)
2532 $$
= access_protected_virtual_node
;
2533 else if
($$
== access_private_node
)
2534 $$
= access_private_virtual_node
;
2536 error ("multiple `virtual' specifiers");
2540 opt.component_decl_list
:
2541 | component_decl_list
2542 | opt.component_decl_list access_specifier component_decl_list
2543 | opt.component_decl_list access_specifier
2549 current_access_specifier
= $1;
2553 /* Note: we no longer warn about the semicolon after a component_decl_list.
2554 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2555 component_decl_list:
2558 finish_member_declaration
($1);
2559 current_aggr
= NULL_TREE
;
2560 reset_type_access_control
();
2562 | component_decl_list component_decl
2564 finish_member_declaration
($2);
2565 current_aggr
= NULL_TREE
;
2566 reset_type_access_control
();
2571 component_decl_1
';'
2572 | component_decl_1
'}'
2573 { error ("missing ';' before right brace");
2574 yyungetc
('}', 0); }
2575 /* C++: handle constructors, destructors and inline functions */
2576 /* note that INLINE is like a TYPESPEC */
2577 | fn.def2
':' /* base_init compstmt */
2578 { $$
= finish_method
($$
); }
2579 | fn.def2 TRY
/* base_init compstmt */
2580 { $$
= finish_method
($$
); }
2581 | fn.def2 RETURN_KEYWORD
/* base_init compstmt */
2582 { $$
= finish_method
($$
); }
2583 | fn.def2
'{' /* nodecls compstmt */
2584 { $$
= finish_method
($$
); }
2587 | extension component_decl
2590 | template_header component_decl
2593 $$
= finish_member_template_decl
($2);
2595 /* The component was already processed. */
2598 finish_template_decl
($1);
2600 | template_header typed_declspecs
';'
2602 $$
= finish_member_class_template
($2.t
);
2603 finish_template_decl
($1);
2610 /* Do not add a "typed_declspecs declarator" rule here for
2611 speed; we need to call grok_x_components for enums, so the
2612 speedup would be insignificant. */
2613 typed_declspecs components
2615 /* Most of the productions for component_decl only
2616 allow the creation of one new member, so we call
2617 finish_member_declaration in component_decl_list.
2618 For this rule and the next, however, there can be
2619 more than one member, e.g.:
2623 and we need the first member to be fully
2624 registered before the second is processed.
2625 Therefore, the rules for components take care of
2626 this processing. To avoid registering the
2627 components more than once, we send NULL_TREE up
2628 here; that lets finish_member_declaration know
2629 that there is nothing to do. */
2631 grok_x_components
($1.t
);
2634 | declmods notype_components
2637 grok_x_components
($1.t
);
2640 | notype_declarator maybeasm maybe_attribute maybe_init
2641 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2642 | constructor_declarator maybeasm maybe_attribute maybe_init
2643 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2644 |
':' expr_no_commas
2645 { $$
= grokbitfield
(NULL_TREE
, NULL_TREE
, $2); }
2649 /* These rules introduce a reduce/reduce conflict; in
2650 typedef int foo, bar;
2654 should "A::foo" be declared as a function or "A::bar" as a data
2655 member? In other words, is "bar" an after_type_declarator or a
2657 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2658 { tree specs
, attrs
;
2659 split_specs_attrs
($1.t
, &specs
, &attrs
);
2660 $$
= grokfield
($2, specs
, $5, $3,
2661 chainon
($4, attrs
)); }
2662 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2663 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2665 { $$
= do_class_using_decl
($1); }
2667 /* The case of exactly one component is handled directly by component_decl. */
2670 /* empty: possibly anonymous */
2672 | component_declarator0
2674 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2675 $1 = finish_member_template_decl
($1);
2676 finish_member_declaration
($1);
2679 | components
',' component_declarator
2681 check_multiple_declarators
();
2682 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2683 $3 = finish_member_template_decl
($3);
2684 finish_member_declaration
($3);
2690 /* empty: possibly anonymous */
2692 | notype_component_declarator0
2694 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2695 $1 = finish_member_template_decl
($1);
2696 finish_member_declaration
($1);
2699 | notype_components
',' notype_component_declarator
2701 check_multiple_declarators
();
2702 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2703 $3 = finish_member_template_decl
($3);
2704 finish_member_declaration
($3);
2709 component_declarator0:
2710 after_type_component_declarator0
2711 | notype_component_declarator0
2714 component_declarator:
2715 after_type_component_declarator
2716 | notype_component_declarator
2719 after_type_component_declarator0:
2720 after_type_declarator maybeasm maybe_attribute maybe_init
2721 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2723 | TYPENAME
':' expr_no_commas maybe_attribute
2724 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2728 notype_component_declarator0:
2729 notype_declarator maybeasm maybe_attribute maybe_init
2730 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2732 | constructor_declarator maybeasm maybe_attribute maybe_init
2733 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2735 | IDENTIFIER
':' expr_no_commas maybe_attribute
2736 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2738 |
':' expr_no_commas maybe_attribute
2739 { $$
= parse_bitfield0
(NULL_TREE
, $
<ftype
>0.t
,
2740 $
<ftype
>0.lookups
, $3, $2); }
2743 after_type_component_declarator:
2744 after_type_declarator maybeasm maybe_attribute maybe_init
2745 { $$
= parse_field
($1, $3, $2, $4); }
2746 | TYPENAME
':' expr_no_commas maybe_attribute
2747 { $$
= parse_bitfield
($1, $4, $3); }
2750 notype_component_declarator:
2751 notype_declarator maybeasm maybe_attribute maybe_init
2752 { $$
= parse_field
($1, $3, $2, $4); }
2753 | IDENTIFIER
':' expr_no_commas maybe_attribute
2754 { $$
= parse_bitfield
($1, $4, $3); }
2755 |
':' expr_no_commas maybe_attribute
2756 { $$
= parse_bitfield
(NULL_TREE
, $3, $2); }
2760 enumlist maybecomma_warn
2764 /* We chain the enumerators in reverse order.
2765 Because of the way enums are built, the order is
2766 insignificant. Take advantage of this fact. */
2770 | enumlist
',' enumerator
2775 { build_enumerator
($1, NULL_TREE
, current_enum_type
); }
2776 | identifier
'=' expr_no_commas
2777 { build_enumerator
($1, $3, current_enum_type
); }
2780 /* ISO new-type-id (5.3.4) */
2782 type_specifier_seq new_declarator
2783 { $$.t
= build_tree_list
($1.t
, $2);
2784 $$.new_type_flag
= $1.new_type_flag
; }
2785 | type_specifier_seq %prec EMPTY
2786 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
2787 $$.new_type_flag
= $1.new_type_flag
; }
2788 /* GNU extension to allow arrays of arbitrary types with
2789 non-constant dimension. */
2790 |
'(' type_id
')' '[' expr
']'
2793 pedwarn
("ISO C++ forbids array dimensions with parenthesized type in new");
2794 $$.t
= build_nt
(ARRAY_REF
, TREE_VALUE
($2.t
), $5);
2795 $$.t
= build_tree_list
(TREE_PURPOSE
($2.t
), $$.t
);
2796 $$.new_type_flag
= $2.new_type_flag
;
2801 /* empty */ %prec EMPTY
2803 | cv_qualifiers CV_QUALIFIER
2804 { $$
= tree_cons
(NULL_TREE
, $2, $$
); }
2807 nonempty_cv_qualifiers:
2809 { $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
2810 $$.new_type_flag
= 0; }
2811 | nonempty_cv_qualifiers CV_QUALIFIER
2812 { $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
2813 $$.new_type_flag
= $1.new_type_flag
; }
2816 /* These rules must follow the rules for function declarations
2817 and component declarations. That way, longer rules are preferred. */
2819 /* An expression which will not live on the momentary obstack. */
2821 '(' nonnull_exprlist
')'
2826 { $$
= empty_parms
(); }
2831 /* A declarator that is allowed only after an explicit typespec. */
2833 after_type_declarator_intern:
2834 after_type_declarator
2835 | attributes after_type_declarator
2837 /* Provide support for '(' attributes '*' declarator ')'
2839 $$
= tree_cons
($1, $2, NULL_TREE
);
2843 /* may all be followed by prec '.' */
2844 after_type_declarator:
2845 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2846 { $$
= make_pointer_declarator
($2.t
, $3); }
2847 |
'&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2848 { $$
= make_reference_declarator
($2.t
, $3); }
2849 |
'*' after_type_declarator_intern %prec UNARY
2850 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2851 |
'&' after_type_declarator_intern %prec UNARY
2852 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2853 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2854 { tree arg
= make_pointer_declarator
($2, $3);
2855 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2857 | direct_after_type_declarator
2860 direct_after_type_declarator:
2861 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
2862 { $$
= make_call_declarator
($$
, $2, $3, $4); }
2863 | direct_after_type_declarator
'[' expr
']'
2864 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
2865 | direct_after_type_declarator
'[' ']'
2866 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
2867 |
'(' after_type_declarator_intern
')'
2869 | nested_name_specifier type_name %prec EMPTY
2870 { push_nested_class
($1, 3);
2871 $$
= build_nt
(SCOPE_REF
, $$
, $2);
2872 TREE_COMPLEXITY
($$
) = current_class_depth
; }
2873 | type_name %prec EMPTY
2877 type_name %prec EMPTY
2879 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
2881 $$
= lookup_name
($1, 1);
2882 maybe_note_name_used_in_class
($1, $$
);
2887 | global_scope type_name
2889 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
2890 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
2893 got_scope
= NULL_TREE
;
2900 | global_scope nested_type
2905 nested_name_specifier type_name %prec EMPTY
2906 { $$
= get_type_decl
($2); }
2909 /* A declarator allowed whether or not there has been
2910 an explicit typespec. These cannot redeclare a typedef-name. */
2912 notype_declarator_intern:
2914 | attributes notype_declarator
2916 /* Provide support for '(' attributes '*' declarator ')'
2918 $$
= tree_cons
($1, $2, NULL_TREE
);
2923 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2924 { $$
= make_pointer_declarator
($2.t
, $3); }
2925 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2926 { $$
= make_reference_declarator
($2.t
, $3); }
2927 |
'*' notype_declarator_intern %prec UNARY
2928 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2929 |
'&' notype_declarator_intern %prec UNARY
2930 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2931 | ptr_to_mem cv_qualifiers notype_declarator_intern
2932 { tree arg
= make_pointer_declarator
($2, $3);
2933 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2935 | direct_notype_declarator
2938 complex_notype_declarator:
2939 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2940 { $$
= make_pointer_declarator
($2.t
, $3); }
2941 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2942 { $$
= make_reference_declarator
($2.t
, $3); }
2943 |
'*' complex_notype_declarator %prec UNARY
2944 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2945 |
'&' complex_notype_declarator %prec UNARY
2946 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2947 | ptr_to_mem cv_qualifiers notype_declarator_intern
2948 { tree arg
= make_pointer_declarator
($2, $3);
2949 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2951 | complex_direct_notype_declarator
2954 complex_direct_notype_declarator:
2955 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
2956 { $$
= make_call_declarator
($$
, $2, $3, $4); }
2957 |
'(' complex_notype_declarator
')'
2959 | direct_notype_declarator
'[' expr
']'
2960 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
2961 | direct_notype_declarator
'[' ']'
2962 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
2963 | notype_qualified_id
2964 { enter_scope_of
($1); }
2965 | global_scope notype_qualified_id
2966 { enter_scope_of
($2); $$
= $2;}
2967 | global_scope notype_unqualified_id
2968 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $2);
2969 enter_scope_of
($$
);
2971 | nested_name_specifier notype_template_declarator
2972 { got_scope
= NULL_TREE
;
2973 $$
= build_nt
(SCOPE_REF
, $1, $2);
2974 enter_scope_of
($$
);
2979 nested_name_specifier unqualified_id
2980 { got_scope
= NULL_TREE
;
2981 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
2982 | nested_name_specifier object_template_id
2983 { got_scope
= NULL_TREE
;
2984 $$
= build_nt
(SCOPE_REF
, $1, $2); }
2987 notype_qualified_id:
2988 nested_name_specifier notype_unqualified_id
2989 { got_scope
= NULL_TREE
;
2990 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
2991 | nested_name_specifier object_template_id
2992 { got_scope
= NULL_TREE
;
2993 $$
= build_nt
(SCOPE_REF
, $1, $2); }
2998 | global_scope notype_qualified_id
3003 typespec
'(' nonnull_exprlist
')'
3004 { $$
= build_functional_cast
($1.t
, $3); }
3005 | typespec
'(' expr_or_declarator_intern
')'
3006 { $$
= reparse_decl_as_expr
($1.t
, $3); }
3007 | typespec fcast_or_absdcl %prec EMPTY
3008 { $$
= reparse_absdcl_as_expr
($1.t
, $2); }
3014 | template_type %prec EMPTY
3017 nested_name_specifier:
3018 nested_name_specifier_1
3019 | nested_name_specifier nested_name_specifier_1
3021 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
3023 = make_typename_type
($1, $3, /*complain=*/1); }
3024 /* Error handling per Core 125. */
3025 | nested_name_specifier IDENTIFIER SCOPE
3027 = make_typename_type
($1, $2, /*complain=*/1); }
3028 | nested_name_specifier PTYPENAME SCOPE
3030 = make_typename_type
($1, $2, /*complain=*/1); }
3033 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3034 inline here?!? (jason) */
3035 nested_name_specifier_1:
3038 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3041 maybe_note_name_used_in_class
($1, $$
);
3044 complete_type
(TYPE_MAIN_VARIANT
(TREE_TYPE
($$
)));
3048 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3050 got_scope
= $$
= TREE_TYPE
($$
);
3054 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3058 | template_type SCOPE
3059 { got_scope
= $$
= complete_type
(TREE_TYPE
($1)); }
3064 | global_scope typename_sub0
3069 typename_sub1 identifier %prec EMPTY
3072 $$
= make_typename_type
($1, $2, /*complain=*/1);
3073 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3074 cp_error
("`%T' is not a class or namespace", $2);
3078 if
(TREE_CODE
($$
) == TYPE_DECL
)
3079 $$
= TREE_TYPE
($$
);
3082 | typename_sub1 template_type %prec EMPTY
3083 { $$
= TREE_TYPE
($2); }
3084 | typename_sub1 explicit_template_type %prec EMPTY
3085 { $$
= make_typename_type
($1, $2, /*complain=*/1); }
3086 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
3087 { $$
= make_typename_type
($1, $3, /*complain=*/1); }
3093 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3094 cp_error
("`%T' is not a class or namespace", $1);
3095 else if
(TREE_CODE
($1) == TYPE_DECL
)
3096 $$
= TREE_TYPE
($1);
3098 | typename_sub1 typename_sub2
3101 $$
= make_typename_type
($1, $2, /*complain=*/1);
3102 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3103 cp_error
("`%T' is not a class or namespace", $2);
3107 if
(TREE_CODE
($$
) == TYPE_DECL
)
3108 $$
= TREE_TYPE
($$
);
3111 | typename_sub1 explicit_template_type SCOPE
3113 = make_typename_type
($1, $2, /*complain=*/1); }
3114 | typename_sub1 TEMPLATE explicit_template_type SCOPE
3116 = make_typename_type
($1, $3, /*complain=*/1); }
3119 /* This needs to return a TYPE_DECL for simple names so that we don't
3120 forget what name was used. */
3124 if
(TREE_CODE
($1) != TYPE_DECL
)
3127 /* Retrieve the type for the identifier, which might involve
3128 some computation. */
3129 got_scope
= complete_type
(TREE_TYPE
($$
));
3131 if
($$
== error_mark_node
)
3132 cp_error
("`%T' is not a class or namespace", $1);
3136 if
(TREE_CODE
($1) != TYPE_DECL
)
3138 got_scope
= complete_type
(TREE_TYPE
($$
));
3140 | template_type SCOPE
3141 { got_scope
= $$
= complete_type
(TREE_TYPE
($$
)); }
3146 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3152 explicit_template_type:
3153 identifier
'<' template_arg_list_opt template_close_bracket
3154 { $$
= build_min_nt
(TEMPLATE_ID_EXPR
, $1, $3); }
3158 global_scope type_name
3160 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3161 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
3164 got_scope
= NULL_TREE
;
3167 | global_scope nested_type
3172 nested_name_specifier
'*'
3173 { got_scope
= NULL_TREE
; }
3174 | global_scope nested_name_specifier
'*'
3175 { $$
= $2; got_scope
= NULL_TREE
; }
3178 /* All uses of explicit global scope must go through this nonterminal so
3179 that got_scope will be set before yylex is called to get the next token. */
3182 { got_scope
= void_type_node
; }
3185 /* ISO new-declarator (5.3.4) */
3187 '*' cv_qualifiers new_declarator
3188 { $$
= make_pointer_declarator
($2, $3); }
3189 |
'*' cv_qualifiers %prec EMPTY
3190 { $$
= make_pointer_declarator
($2, NULL_TREE
); }
3191 |
'&' cv_qualifiers new_declarator %prec EMPTY
3192 { $$
= make_reference_declarator
($2, $3); }
3193 |
'&' cv_qualifiers %prec EMPTY
3194 { $$
= make_reference_declarator
($2, NULL_TREE
); }
3195 | ptr_to_mem cv_qualifiers %prec EMPTY
3196 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3197 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3199 | ptr_to_mem cv_qualifiers new_declarator
3200 { tree arg
= make_pointer_declarator
($2, $3);
3201 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3203 | direct_new_declarator %prec EMPTY
3206 /* ISO direct-new-declarator (5.3.4) */
3207 direct_new_declarator:
3209 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3210 | direct_new_declarator
'[' expr
']'
3211 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3218 /* Provide support for '(' attributes '*' declarator ')'
3220 $$
= tree_cons
($1, $2, NULL_TREE
);
3224 /* ISO abstract-declarator (8.1) */
3226 '*' nonempty_cv_qualifiers absdcl_intern
3227 { $$
= make_pointer_declarator
($2.t
, $3); }
3229 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
3230 |
'*' nonempty_cv_qualifiers %prec EMPTY
3231 { $$
= make_pointer_declarator
($2.t
, NULL_TREE
); }
3233 { $$
= make_pointer_declarator
(NULL_TREE
, NULL_TREE
); }
3234 |
'&' nonempty_cv_qualifiers absdcl_intern
3235 { $$
= make_reference_declarator
($2.t
, $3); }
3237 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
3238 |
'&' nonempty_cv_qualifiers %prec EMPTY
3239 { $$
= make_reference_declarator
($2.t
, NULL_TREE
); }
3241 { $$
= make_reference_declarator
(NULL_TREE
, NULL_TREE
); }
3242 | ptr_to_mem cv_qualifiers %prec EMPTY
3243 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3244 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3246 | ptr_to_mem cv_qualifiers absdcl_intern
3247 { tree arg
= make_pointer_declarator
($2, $3);
3248 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3250 | direct_abstract_declarator %prec EMPTY
3253 /* ISO direct-abstract-declarator (8.1) */
3254 direct_abstract_declarator:
3255 '(' absdcl_intern
')'
3257 /* `(typedef)1' is `int'. */
3258 | direct_abstract_declarator
'(' parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3259 { $$
= make_call_declarator
($$
, $3, $5, $6); }
3260 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec
'.'
3261 { $$
= make_call_declarator
($$
, empty_parms
(), $3, $4); }
3262 | direct_abstract_declarator
'[' expr
']' %prec
'.'
3263 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3264 | direct_abstract_declarator
'[' ']' %prec
'.'
3265 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
3266 |
'(' complex_parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3267 { $$
= make_call_declarator
(NULL_TREE
, $2, $4, $5); }
3268 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3269 { set_quals_and_spec
($$
, $2, $3); }
3270 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3271 { set_quals_and_spec
($$
, $2, $3); }
3272 |
'[' expr
']' %prec
'.'
3273 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3275 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, NULL_TREE
); }
3278 /* For C++, decls and stmts can be intermixed, so we don't need to
3279 have a special rule that won't start parsing the stmt section
3280 until we have a stmt that parses without errors. */
3293 /* Read zero or more forward-declarations for labels
3294 that nested functions can jump to. */
3299 pedwarn
("ISO C++ forbids label declarations"); }
3304 | label_decls label_decl
3308 LABEL identifiers_or_typenames
';'
3312 finish_label_decl
(TREE_VALUE
($2));
3313 $2 = TREE_CHAIN
($2);
3318 /* This is the body of a function definition.
3319 It causes syntax errors to ignore to the next openbrace. */
3327 { $
<ttype
>$
= begin_compound_stmt
(0); }
3329 { STMT_LINENO
($
<ttype
>3) = $1;
3330 finish_compound_stmt
(0, $
<ttype
>3); }
3335 { $
<ttype
>$
= begin_if_stmt
();
3336 cond_stmt_keyword
= "if"; }
3338 { finish_if_stmt_cond
($3, $
<ttype
>2); }
3339 implicitly_scoped_stmt
3341 finish_then_clause
($
<ttype
>2); }
3344 implicitly_scoped_stmt:
3347 { $
<ttype
>$
= begin_compound_stmt
(0); }
3348 save_lineno simple_stmt
3349 { STMT_LINENO
($
<ttype
>1) = $2;
3350 if
($3) STMT_LINENO
($3) = $2;
3351 finish_compound_stmt
(0, $
<ttype
>1); }
3356 | save_lineno simple_stmt
3357 { if
($2) STMT_LINENO
($2) = $1; }
3365 { $$
= finish_expr_stmt
($1); }
3367 { begin_else_clause
(); }
3368 implicitly_scoped_stmt
3371 finish_else_clause
($1);
3374 | simple_if %prec IF
3376 finish_if_stmt
(); }
3379 $
<ttype
>$
= begin_while_stmt
();
3380 cond_stmt_keyword
= "while";
3383 { finish_while_stmt_cond
($3, $
<ttype
>2); }
3384 implicitly_scoped_stmt
3386 finish_while_stmt
($
<ttype
>2); }
3388 { $
<ttype
>$
= begin_do_stmt
(); }
3389 implicitly_scoped_stmt WHILE
3391 finish_do_body
($
<ttype
>2);
3392 cond_stmt_keyword
= "do";
3394 paren_expr_or_null
';'
3396 finish_do_stmt
($6, $
<ttype
>2); }
3398 { $
<ttype
>$
= begin_for_stmt
(); }
3399 '(' for.init.statement
3400 { finish_for_init_stmt
($
<ttype
>2); }
3402 { finish_for_cond
($6, $
<ttype
>2); }
3404 { finish_for_expr
($9, $
<ttype
>2); }
3405 implicitly_scoped_stmt
3407 finish_for_stmt
($
<ttype
>2); }
3409 { $
<ttype
>$
= begin_switch_stmt
(); }
3411 { finish_switch_cond
($4, $
<ttype
>2); }
3412 implicitly_scoped_stmt
3414 finish_switch_stmt
($
<ttype
>2); }
3415 | CASE expr_no_commas
':'
3416 { $
<ttype
>$
= finish_case_label
($2, NULL_TREE
); }
3419 | CASE expr_no_commas ELLIPSIS expr_no_commas
':'
3420 { $
<ttype
>$
= finish_case_label
($2, $4); }
3424 { $
<ttype
>$
= finish_case_label
(NULL_TREE
, NULL_TREE
); }
3428 { $$
= finish_break_stmt
(); }
3430 { $$
= finish_continue_stmt
(); }
3431 | RETURN_KEYWORD
';'
3432 { $$
= finish_return_stmt
(NULL_TREE
); }
3433 | RETURN_KEYWORD expr
';'
3434 { $$
= finish_return_stmt
($2); }
3435 | asm_keyword maybe_cv_qualifier
'(' string ')' ';'
3436 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, NULL_TREE
,
3438 ASM_INPUT_P
($$
) = 1; }
3439 /* This is the case with just output operands. */
3440 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
')' ';'
3441 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, NULL_TREE
); }
3442 /* This is the case with input operands as well. */
3443 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
':'
3444 asm_operands
')' ';'
3445 { $$
= finish_asm_stmt
($2, $4, $6, $8, NULL_TREE
); }
3446 | asm_keyword maybe_cv_qualifier
'(' string SCOPE asm_operands
')' ';'
3447 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, NULL_TREE
); }
3448 /* This is the case with clobbered registers as well. */
3449 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
':'
3450 asm_operands
':' asm_clobbers
')' ';'
3451 { $$
= finish_asm_stmt
($2, $4, $6, $8, $10); }
3452 | asm_keyword maybe_cv_qualifier
'(' string SCOPE asm_operands
':'
3453 asm_clobbers
')' ';'
3454 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, $8); }
3455 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands SCOPE
3456 asm_clobbers
')' ';'
3457 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, $8); }
3461 pedwarn
("ISO C++ forbids computed gotos");
3462 $$
= finish_goto_stmt
($3);
3464 | GOTO identifier
';'
3465 { $$
= finish_goto_stmt
($2); }
3469 { error ("label must be followed by statement");
3479 | namespace_using_decl
3480 { do_local_using_decl
($1);
3488 { $
<ttype
>$
= begin_function_try_block
(); }
3489 ctor_initializer_opt compstmt
3490 { finish_function_try_block
($
<ttype
>2); }
3493 finish_function_handler_sequence
($
<ttype
>2);
3500 { $
<ttype
>$
= begin_try_block
(); }
3502 { finish_try_block
($
<ttype
>2); }
3504 { finish_handler_sequence
($
<ttype
>2); }
3509 | handler_seq handler
3514 { $
<ttype
>$
= begin_handler
(); }
3516 { finish_handler_parms
($3, $
<ttype
>2); }
3518 { finish_handler
($
<ttype
>2); }
3522 typed_typespecs %prec EMPTY
3523 | nonempty_cv_qualifiers %prec EMPTY
3529 /* This doesn't allow reference parameters, the below does.
3530 | '(' type_specifier_seq absdcl ')'
3531 { check_for_new_type ("inside exception declarations", $2);
3532 expand_start_catch_block ($2.t, $3); }
3533 | '(' type_specifier_seq ')'
3534 { check_for_new_type ("inside exception declarations", $2);
3535 expand_start_catch_block ($2.t, NULL_TREE); }
3536 | '(' type_specifier_seq notype_declarator ')'
3537 { check_for_new_type ("inside exception declarations", $2);
3538 expand_start_catch_block ($2.t, $3); }
3539 | '(' typed_typespecs after_type_declarator ')'
3540 { check_for_new_type ("inside exception declarations", $2);
3541 expand_start_catch_block ($2.t, $3); }
3542 This allows reference parameters... */
3545 check_for_new_type
("inside exception declarations", $2);
3546 $$
= start_handler_parms
(TREE_PURPOSE
($2.t
),
3553 { finish_label_stmt
($1); }
3555 { finish_label_stmt
($1); }
3557 { finish_label_stmt
($1); }
3559 { finish_label_stmt
($1); }
3564 { finish_expr_stmt
($1); }
3568 pedwarn
("ISO C++ forbids compound statements inside for initializations");
3572 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3588 /* These are the operands other than the first string and colon
3589 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3593 | nonnull_asm_operands
3596 nonnull_asm_operands:
3598 | nonnull_asm_operands
',' asm_operand
3599 { $$
= chainon
($$
, $3); }
3604 { $$
= build_tree_list
(build_tree_list
(NULL_TREE
, $1), $3); }
3605 |
'[' identifier
']' STRING
'(' expr
')'
3606 { $$
= build_tree_list
(build_tree_list
($2, $4), $6); }
3611 { $$
= tree_cons
(NULL_TREE
, combine_strings
($1), NULL_TREE
);}
3612 | asm_clobbers
',' string
3613 { $$
= tree_cons
(NULL_TREE
, combine_strings
($3), $1); }
3616 /* This is what appears inside the parens in a function declarator.
3617 Its value is represented in the format that grokdeclarator expects.
3619 In C++, declaring a function with no parameters
3620 means that that function takes *no* parameters. */
3629 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
, $1.t
), 0);
3630 check_for_new_type
("inside parameter list", $1); }
3633 /* This nonterminal does not include the common sequence '(' type_id ')',
3634 as it is ambiguous and must be disambiguated elsewhere. */
3637 { $$
= finish_parmlist
($$
, 0); }
3638 | parms_comma ELLIPSIS
3639 { $$
= finish_parmlist
($1, 1); }
3640 /* C++ allows an ellipsis without a separating ',' */
3642 { $$
= finish_parmlist
($1, 1); }
3644 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3647 { $$
= finish_parmlist
(NULL_TREE
, 1); }
3650 /* This helps us recover from really nasty
3651 parse errors, for example, a missing right
3653 yyerror ("possibly missing ')'");
3654 $$
= finish_parmlist
($1, 0);
3660 /* This helps us recover from really nasty
3661 parse errors, for example, a missing right
3663 yyerror ("possibly missing ')'");
3664 $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3671 /* A default argument to a */
3674 { maybe_snarf_defarg
(); }
3684 /* A nonempty list of parameter declarations or type names. */
3687 { check_for_new_type
("in a parameter list", $1);
3688 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3690 { check_for_new_type
("in a parameter list", $1);
3691 $$
= build_tree_list
($2, $1.t
); }
3692 | parms_comma full_parm
3693 { check_for_new_type
("in a parameter list", $2);
3694 $$
= chainon
($$
, $2.t
); }
3695 | parms_comma bad_parm
3696 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $2)); }
3697 | parms_comma bad_parm
'=' init
3698 { $$
= chainon
($$
, build_tree_list
($4, $2)); }
3704 { check_for_new_type
("in a parameter list", $1);
3705 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3708 /* A single parameter declaration or parameter type name,
3709 as found in a parmlist. */
3711 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3712 TYPESPEC IDENTIFIER. */
3713 typed_declspecs1 declarator
3714 { tree specs
= strip_attrs
($1.t
);
3715 $$.new_type_flag
= $1.new_type_flag
;
3716 $$.t
= build_tree_list
(specs
, $2); }
3717 | typed_typespecs declarator
3718 { $$.t
= build_tree_list
($1.t
, $2);
3719 $$.new_type_flag
= $1.new_type_flag
; }
3720 | typespec declarator
3721 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
3723 $$.new_type_flag
= $1.new_type_flag
; }
3724 | typed_declspecs1 absdcl
3725 { tree specs
= strip_attrs
($1.t
);
3726 $$.t
= build_tree_list
(specs
, $2);
3727 $$.new_type_flag
= $1.new_type_flag
; }
3728 | typed_declspecs1 %prec EMPTY
3729 { tree specs
= strip_attrs
($1.t
);
3730 $$.t
= build_tree_list
(specs
, NULL_TREE
);
3731 $$.new_type_flag
= $1.new_type_flag
; }
3732 | declmods notype_declarator
3733 { tree specs
= strip_attrs
($1.t
);
3734 $$.t
= build_tree_list
(specs
, $2);
3735 $$.new_type_flag
= 0; }
3740 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
3741 $$.new_type_flag
= $1.new_type_flag
; }
3743 { $$.t
= build_tree_list
($2, $1.t
);
3744 $$.new_type_flag
= $1.new_type_flag
; }
3753 /* empty */ %prec EMPTY
3754 { see_typename
(); }
3758 /* empty */ %prec EMPTY
3760 error ("type specifier omitted for parameter");
3761 $$
= build_tree_list
(integer_type_node
, NULL_TREE
);
3765 error ("type specifier omitted for parameter");
3766 if
(TREE_CODE
($$
) == SCOPE_REF
3767 && (TREE_CODE
(TREE_OPERAND
($$
, 0)) == TEMPLATE_TYPE_PARM
3768 || TREE_CODE
(TREE_OPERAND
($$
, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM
))
3769 cp_error
(" perhaps you want `typename %E' to make it a type", $$
);
3770 $$
= build_tree_list
(integer_type_node
, $$
);
3775 IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore
';'
3777 cp_error
("'%D' is used as a type, but is not defined as a type.", $1);
3778 $3 = error_mark_node
;
3782 template_arg_list_ignore:
3783 '<' template_arg_list_opt template_close_bracket
3789 '(' nonnull_exprlist
')'
3794 exception_specification_opt:
3795 /* empty */ %prec EMPTY
3797 | THROW
'(' ansi_raise_identifiers
')' %prec EMPTY
3799 | THROW LEFT_RIGHT %prec EMPTY
3800 { $$
= empty_except_spec
; }
3803 ansi_raise_identifier:
3806 check_for_new_type
("exception specifier", $1);
3807 $$
= groktypename
($1.t
);
3811 ansi_raise_identifiers:
3812 ansi_raise_identifier
3813 { $$
= add_exception_specifier
(NULL_TREE
, $1, 1); }
3814 | ansi_raise_identifiers
',' ansi_raise_identifier
3815 { $$
= add_exception_specifier
($1, $3, 1); }
3818 conversion_declarator:
3819 /* empty */ %prec EMPTY
3821 |
'*' cv_qualifiers conversion_declarator
3822 { $$
= make_pointer_declarator
($2, $3); }
3823 |
'&' cv_qualifiers conversion_declarator
3824 { $$
= make_reference_declarator
($2, $3); }
3825 | ptr_to_mem cv_qualifiers conversion_declarator
3826 { tree arg
= make_pointer_declarator
($2, $3);
3827 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3834 saved_scopes
= tree_cons
(got_scope
, got_object
, saved_scopes
);
3835 TREE_LANG_FLAG_0
(saved_scopes
) = looking_for_typename
;
3836 /* We look for conversion-type-id's in both the class and current
3837 scopes, just as for ID in 'ptr->ID::'. */
3838 looking_for_typename
= 1;
3839 got_object
= got_scope
;
3840 got_scope
= NULL_TREE
;
3845 { got_scope
= TREE_PURPOSE
(saved_scopes
);
3846 got_object
= TREE_VALUE
(saved_scopes
);
3847 looking_for_typename
= TREE_LANG_FLAG_0
(saved_scopes
);
3848 saved_scopes
= TREE_CHAIN
(saved_scopes
);
3853 operator
'*' unoperator
3854 { $$
= frob_opname
(ansi_opname
(MULT_EXPR
)); }
3855 | operator
'/' unoperator
3856 { $$
= frob_opname
(ansi_opname
(TRUNC_DIV_EXPR
)); }
3857 | operator
'%' unoperator
3858 { $$
= frob_opname
(ansi_opname
(TRUNC_MOD_EXPR
)); }
3859 | operator
'+' unoperator
3860 { $$
= frob_opname
(ansi_opname
(PLUS_EXPR
)); }
3861 | operator
'-' unoperator
3862 { $$
= frob_opname
(ansi_opname
(MINUS_EXPR
)); }
3863 | operator
'&' unoperator
3864 { $$
= frob_opname
(ansi_opname
(BIT_AND_EXPR
)); }
3865 | operator
'|' unoperator
3866 { $$
= frob_opname
(ansi_opname
(BIT_IOR_EXPR
)); }
3867 | operator
'^' unoperator
3868 { $$
= frob_opname
(ansi_opname
(BIT_XOR_EXPR
)); }
3869 | operator
'~' unoperator
3870 { $$
= frob_opname
(ansi_opname
(BIT_NOT_EXPR
)); }
3871 | operator
',' unoperator
3872 { $$
= frob_opname
(ansi_opname
(COMPOUND_EXPR
)); }
3873 | operator ARITHCOMPARE unoperator
3874 { $$
= frob_opname
(ansi_opname
($2)); }
3875 | operator
'<' unoperator
3876 { $$
= frob_opname
(ansi_opname
(LT_EXPR
)); }
3877 | operator
'>' unoperator
3878 { $$
= frob_opname
(ansi_opname
(GT_EXPR
)); }
3879 | operator EQCOMPARE unoperator
3880 { $$
= frob_opname
(ansi_opname
($2)); }
3881 | operator ASSIGN unoperator
3882 { $$
= frob_opname
(ansi_assopname
($2)); }
3883 | operator
'=' unoperator
3884 { $$
= frob_opname
(ansi_assopname
(NOP_EXPR
)); }
3885 | operator LSHIFT unoperator
3886 { $$
= frob_opname
(ansi_opname
($2)); }
3887 | operator RSHIFT unoperator
3888 { $$
= frob_opname
(ansi_opname
($2)); }
3889 | operator PLUSPLUS unoperator
3890 { $$
= frob_opname
(ansi_opname
(POSTINCREMENT_EXPR
)); }
3891 | operator MINUSMINUS unoperator
3892 { $$
= frob_opname
(ansi_opname
(PREDECREMENT_EXPR
)); }
3893 | operator ANDAND unoperator
3894 { $$
= frob_opname
(ansi_opname
(TRUTH_ANDIF_EXPR
)); }
3895 | operator OROR unoperator
3896 { $$
= frob_opname
(ansi_opname
(TRUTH_ORIF_EXPR
)); }
3897 | operator
'!' unoperator
3898 { $$
= frob_opname
(ansi_opname
(TRUTH_NOT_EXPR
)); }
3899 | operator
'?' ':' unoperator
3900 { $$
= frob_opname
(ansi_opname
(COND_EXPR
)); }
3901 | operator MIN_MAX unoperator
3902 { $$
= frob_opname
(ansi_opname
($2)); }
3903 | operator POINTSAT unoperator %prec EMPTY
3904 { $$
= frob_opname
(ansi_opname
(COMPONENT_REF
)); }
3905 | operator POINTSAT_STAR unoperator %prec EMPTY
3906 { $$
= frob_opname
(ansi_opname
(MEMBER_REF
)); }
3907 | operator LEFT_RIGHT unoperator
3908 { $$
= frob_opname
(ansi_opname
(CALL_EXPR
)); }
3909 | operator
'[' ']' unoperator
3910 { $$
= frob_opname
(ansi_opname
(ARRAY_REF
)); }
3911 | operator NEW unoperator %prec EMPTY
3912 { $$
= frob_opname
(ansi_opname
(NEW_EXPR
)); }
3913 | operator DELETE unoperator %prec EMPTY
3914 { $$
= frob_opname
(ansi_opname
(DELETE_EXPR
)); }
3915 | operator NEW
'[' ']' unoperator
3916 { $$
= frob_opname
(ansi_opname
(VEC_NEW_EXPR
)); }
3917 | operator DELETE
'[' ']' unoperator
3918 { $$
= frob_opname
(ansi_opname
(VEC_DELETE_EXPR
)); }
3919 | operator type_specifier_seq conversion_declarator unoperator
3920 { $$
= frob_opname
(grokoptypename
($2.t
, $3)); }
3921 | operator
error unoperator
3922 { $$
= frob_opname
(ansi_opname
(ERROR_MARK
)); }
3925 /* The forced readahead in here is because we might be at the end of a
3926 line, and lineno won't be bumped until yylex absorbs the first token
3927 on the next line. */
3929 { if
(yychar == YYEMPTY
)
3937 debug_yytranslate
(value
)
3940 return yytname
[YYTRANSLATE
(value
)];