1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
4 Hacked by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
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. */
40 #include "c-pragma.h" /* For YYDEBUG definition. */
46 extern
struct obstack permanent_obstack
;
48 /* Like YYERROR but do call yyerror. */
49 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
51 /* Like the default stack expander, except (1) use realloc when possible,
52 (2) impose no hard maxiumum on stack size, (3) REALLY do not use alloca.
54 Irritatingly, YYSTYPE is defined after this %{ %} block, so we cannot
55 give malloced_yyvs its proper type. This is ok since all we need from
56 it is to be able to free it. */
58 static short *malloced_yyss
;
59 static void *malloced_yyvs
;
61 #define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ) \
66 newsize
= *(YYSSZ
) *= 2; \
70 really_call_realloc
(*(SS
), newsize
* sizeof
(short)); \
72 really_call_realloc
(*(VS
), newsize
* sizeof
(YYSTYPE)); \
76 newss
= (short *) really_call_malloc
(newsize
* sizeof
(short)); \
77 newvs
= (YYSTYPE *) really_call_malloc
(newsize
* sizeof
(YYSTYPE)); \
79 memcpy
(newss
, *(SS
), (SSSIZE
)); \
81 memcpy
(newvs
, *(VS
), (VSSIZE
)); \
83 if
(!newss ||
!newvs
) \
90 malloced_yyss
= newss
; \
91 malloced_yyvs
= (void *) newvs
; \
94 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
95 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
97 /* Contains the statement keyword (if/while/do) to include in an
98 error message if the user supplies an empty conditional expression. */
99 static const char *cond_stmt_keyword
;
101 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
102 int have_extern_spec
;
103 int used_extern_spec
;
105 /* List of types and structure classes of the current declaration. */
106 static GTY
(()) tree current_declspecs
;
108 /* List of prefix attributes in effect.
109 Prefix attributes are parsed by the reserved_declspecs and declmods
110 rules. They create a list that contains *both* declspecs and attrs. */
111 /* ??? It is not clear yet that all cases where an attribute can now appear in
112 a declspec list have been updated. */
113 static GTY
(()) tree prefix_attributes
;
115 /* When defining an enumeration, this is the type of the enumeration. */
116 static GTY
(()) tree current_enum_type
;
118 /* When parsing a conversion operator name, this is the scope of the
120 static GTY
(()) tree saved_scopes
;
122 static tree empty_parms PARAMS
((void));
123 static tree parse_decl0 PARAMS
((tree
, tree
, tree
, tree
, int));
124 static tree parse_decl PARAMS
((tree
, tree
, int));
125 static void parse_end_decl PARAMS
((tree
, tree
, tree
));
126 static tree parse_field0 PARAMS
((tree
, tree
, tree
, tree
, tree
, tree
));
127 static tree parse_field PARAMS
((tree
, tree
, tree
, tree
));
128 static tree parse_bitfield0 PARAMS
((tree
, tree
, tree
, tree
, tree
));
129 static tree parse_bitfield PARAMS
((tree
, tree
, tree
));
130 static tree parse_method PARAMS
((tree
, tree
, tree
));
131 static void frob_specs PARAMS
((tree
, tree
));
132 static void check_class_key PARAMS
((tree
, tree
));
133 static tree parse_scoped_id PARAMS
((tree
));
135 /* Cons up an empty parameter list. */
141 #ifndef NO_IMPLICIT_EXTERN_C
142 if
(in_system_header
&& current_class_type
== NULL
143 && current_lang_name
== lang_name_c
)
147 parms
= void_list_node
;
151 /* Record the decl-specifiers, attributes and type lookups from the
152 decl-specifier-seq in a declaration. */
155 frob_specs
(specs_attrs
, lookups
)
156 tree specs_attrs
, lookups
;
158 save_type_access_control
(lookups
);
159 split_specs_attrs
(specs_attrs
, ¤t_declspecs
, &prefix_attributes
);
160 if
(current_declspecs
161 && TREE_CODE
(current_declspecs
) != TREE_LIST
)
162 current_declspecs
= build_tree_list
(NULL_TREE
, current_declspecs
);
163 if
(have_extern_spec
&& !used_extern_spec
)
165 /* We have to indicate that there is an "extern", but that it
166 was part of a language specifier. For instance,
168 extern "C" typedef int (*Ptr) ();
171 current_declspecs
= tree_cons
(error_mark_node
,
172 get_identifier
("extern"),
174 used_extern_spec
= 1;
179 parse_decl
(declarator
, attributes
, initialized
)
180 tree declarator
, attributes
;
183 return start_decl
(declarator
, current_declspecs
, initialized
,
184 attributes
, prefix_attributes
);
188 parse_decl0
(declarator
, specs_attrs
, lookups
, attributes
, initialized
)
189 tree declarator
, specs_attrs
, lookups
, attributes
;
192 frob_specs
(specs_attrs
, lookups
);
193 return parse_decl
(declarator
, attributes
, initialized
);
197 parse_end_decl
(decl
, init
, asmspec
)
198 tree decl
, init
, asmspec
;
200 /* If decl is NULL_TREE, then this was a variable declaration using
201 () syntax for the initializer, so we handled it in grokdeclarator. */
203 decl_type_access_control
(decl
);
204 cp_finish_decl
(decl
, init
, asmspec
, init ? LOOKUP_ONLYCONVERTING
: 0);
208 parse_field
(declarator
, attributes
, asmspec
, init
)
209 tree declarator
, attributes
, asmspec
, init
;
211 tree d
= grokfield
(declarator
, current_declspecs
, init
, asmspec
,
212 chainon
(attributes
, prefix_attributes
));
213 decl_type_access_control
(d
);
218 parse_field0
(declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
)
219 tree declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
;
221 frob_specs
(specs_attrs
, lookups
);
222 return parse_field
(declarator
, attributes
, asmspec
, init
);
226 parse_bitfield
(declarator
, attributes
, width
)
227 tree declarator
, attributes
, width
;
229 tree d
= grokbitfield
(declarator
, current_declspecs
, width
);
230 cplus_decl_attributes
(&d
, chainon
(attributes
, prefix_attributes
), 0);
231 decl_type_access_control
(d
);
236 parse_bitfield0
(declarator
, specs_attrs
, lookups
, attributes
, width
)
237 tree declarator
, specs_attrs
, lookups
, attributes
, width
;
239 frob_specs
(specs_attrs
, lookups
);
240 return parse_bitfield
(declarator
, attributes
, width
);
244 parse_method
(declarator
, specs_attrs
, lookups
)
245 tree declarator
, specs_attrs
, lookups
;
248 frob_specs
(specs_attrs
, lookups
);
249 d
= start_method
(current_declspecs
, declarator
, prefix_attributes
);
250 decl_type_access_control
(d
);
255 check_class_key
(key
, aggr
)
259 if
(TREE_CODE
(key
) == TREE_LIST
)
260 key
= TREE_VALUE
(key
);
261 if
((key
== union_type_node
) != (TREE_CODE
(aggr
) == UNION_TYPE
))
262 pedwarn
("`%s' tag used in naming `%#T'",
263 key
== union_type_node ?
"union"
264 : key
== record_type_node ?
"struct" : "class", aggr
);
276 flagged_type_tree ftype
;
277 struct unparsed_text
*pi
;
280 /* All identifiers that are not reserved words
281 and are not declared typedefs in the current block */
284 /* All identifiers that are declared typedefs in the current block.
285 In some contexts, they are treated just like IDENTIFIER,
286 but they can also serve as typespecs in declarations. */
290 /* A template function. */
293 /* Reserved words that specify storage class.
294 yylval contains an IDENTIFIER_NODE which indicates which one. */
297 /* Reserved words that specify type.
298 yylval contains an IDENTIFIER_NODE which indicates which one. */
301 /* Reserved words that qualify type: "const" or "volatile".
302 yylval contains an IDENTIFIER_NODE which indicates which one. */
305 /* Character or numeric constants.
306 yylval is the node for the constant. */
309 /* __func__, __FUNCTION__ or __PRETTY_FUNCTION__.
310 yylval contains an IDENTIFIER_NODE which indicates which one. */
311 %token
<ttype
> VAR_FUNC_NAME
313 /* String constants in raw form.
314 yylval is a STRING_CST node. */
317 /* "...", used for functions with variable arglists. */
320 /* the reserved words */
321 /* SCO include files test "ASM", so use something else. */
322 %token SIZEOF ENUM
/* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
323 %token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
325 %token ATTRIBUTE EXTENSION LABEL
326 %token REALPART IMAGPART VA_ARG
328 /* the reserved words... C++ extensions */
330 %token
<ttype
> VISSPEC
331 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
332 %token NAMESPACE TYPENAME_KEYWORD USING
333 %token LEFT_RIGHT TEMPLATE
334 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
337 /* Define the operator tokens and their precedences.
338 The value is an integer because, if used, it is the tree code
339 to use in the expression made from the operator. */
341 %left EMPTY
/* used to resolve s/r with epsilon */
345 /* Add precedence rules to solve dangling else s/r conflict */
349 %left IDENTIFIER PFUNCNAME tTYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD ATTRIBUTE
355 %right
<code
> ASSIGN
'='
363 %left
<code
> EQCOMPARE
364 %left
<code
> ARITHCOMPARE
'<' '>'
365 %left
<code
> LSHIFT RSHIFT
367 %left
<code
> '*' '/' '%'
368 %left
<code
> POINTSAT_STAR DOT_STAR
369 %right
<code
> UNARY PLUSPLUS MINUSMINUS
'~'
371 %left
<ttype
> LEFT_RIGHT
372 %left
<code
> POINTSAT
'.' '(' '['
374 %right SCOPE
/* C++ extension */
375 %nonassoc NEW DELETE TRY CATCH
379 %type
<ttype
> identifier IDENTIFIER tTYPENAME CONSTANT expr nonnull_exprlist
380 %type
<ttype
> PFUNCNAME maybe_identifier
381 %type
<ttype
> paren_expr_or_null nontrivial_exprlist SELFNAME
382 %type
<ttype
> expr_no_commas expr_no_comma_rangle
383 %type
<ttype
> cast_expr unary_expr primary STRING
384 %type
<ttype
> reserved_declspecs boolean_literal
385 %type
<ttype
> reserved_typespecquals
386 %type
<ttype
> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
387 %type
<ttype
> init initlist maybeasm maybe_init defarg defarg1
388 %type
<ttype
> asm_operands nonnull_asm_operands asm_operand asm_clobbers
389 %type
<ttype
> maybe_attribute attributes attribute attribute_list attrib
390 %type
<ttype
> any_word
392 %type
<itype
> save_lineno
393 %type
<ttype
> simple_stmt simple_if
395 %type
<ttype
> declarator notype_declarator after_type_declarator
396 %type
<ttype
> notype_declarator_intern absdcl_intern
397 %type
<ttype
> after_type_declarator_intern
398 %type
<ttype
> direct_notype_declarator direct_after_type_declarator
399 %type
<itype
> components notype_components
400 %type
<ttype
> component_decl component_decl_1
401 %type
<ttype
> component_declarator component_declarator0
402 %type
<ttype
> notype_component_declarator notype_component_declarator0
403 %type
<ttype
> after_type_component_declarator after_type_component_declarator0
404 %type
<ttype
> absdcl cv_qualifiers
405 %type
<ttype
> direct_abstract_declarator conversion_declarator
406 %type
<ttype
> new_declarator direct_new_declarator
407 %type
<ttype
> xexpr parmlist parms bad_parm
408 %type
<ttype
> identifiers_or_typenames
409 %type
<ttype
> fcast_or_absdcl regcast_or_absdcl
410 %type
<ttype
> expr_or_declarator expr_or_declarator_intern
411 %type
<ttype
> complex_notype_declarator
412 %type
<ttype
> notype_unqualified_id unqualified_id qualified_id
413 %type
<ttype
> template_id do_id object_template_id notype_template_declarator
414 %type
<ttype
> overqualified_id notype_qualified_id any_id
415 %type
<ttype
> complex_direct_notype_declarator functional_cast
416 %type
<ttype
> complex_parmlist parms_comma
417 %type
<ttype
> namespace_qualifier namespace_using_decl
419 %type
<ftype
> type_id new_type_id typed_typespecs typespec typed_declspecs
420 %type
<ftype
> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
421 %type
<ftype
> structsp typespecqual_reserved parm named_parm full_parm
422 %type
<ftype
> declmods
424 %type
<itype
> extension
427 %token
<ttype
> PTYPENAME
428 %token
<ttype
> EXTERN_LANG_STRING ALL
429 %token
<ttype
> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
430 %token
<pi
> PRE_PARSED_FUNCTION_DECL
431 %type
<ttype
> component_constructor_declarator
432 %type
<ttype
> fn_def2 return_id constructor_declarator
433 %type
<ttype
> begin_function_body_
434 %type
<ttype
> class_head class_head_apparent_template
435 %type
<ftype
> class_head_decl class_head_defn
436 %type
<ttype
> base_class_list
437 %type
<ttype
> base_class_access_list
438 %type
<ttype
> base_class maybe_base_class_list base_class_1
439 %type
<ttype
> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
440 %type
<ttype
> operator_name
441 %type
<ttype
> object aggr
442 %type
<itype
> new delete
443 /* %type <ttype> primary_no_id */
444 %type
<ttype
> maybe_parmlist
445 %type
<ttype
> member_init
446 %type
<ftype
> member_init_list
447 %type
<ttype
> template_parm_header template_spec_header template_header
448 %type
<ttype
> template_parm_list template_parm
449 %type
<ttype
> template_type_parm template_template_parm
450 %type
<code
> template_close_bracket
451 %type
<ttype
> apparent_template_type
452 %type
<ttype
> template_type template_arg_list template_arg_list_opt
453 %type
<ttype
> template_arg
454 %type
<ttype
> condition xcond paren_cond_or_null
455 %type
<ttype
> type_name nested_name_specifier nested_type ptr_to_mem
456 %type
<ttype
> complete_type_name notype_identifier nonnested_type
457 %type
<ttype
> complex_type_name nested_name_specifier_1
458 %type
<ttype
> new_initializer new_placement
459 %type
<ttype
> using_decl
460 %type
<ttype
> typename_sub typename_sub0 typename_sub1 typename_sub2
461 %type
<ttype
> explicit_template_type
462 /* in order to recognize aggr tags as defining and thus shadowing. */
463 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
464 %type
<ttype
> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
465 %type
<ttype
> handler_args
466 %type
<ttype
> self_template_type finish_template_type_
471 /* Used in lex.c for parsing pragmas. */
474 /* lex.c and pt.c depend on this being the last token. Define
475 any new tokens before this one! */
476 %token END_OF_SAVED_INPUT
479 /* Tell yyparse how to print a token's value, if yydebug is set. */
480 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
481 extern
void yyprint PARAMS
((FILE *, int, YYSTYPE));
487 { finish_translation_unit
(); }
489 { finish_translation_unit
(); }
492 /* the reason for the strange actions in this rule
493 is so that notype_initdecls when reached via datadef
494 can find a valid list of type and sc specs in $0. */
497 { $
<ttype
>$
= NULL_TREE
; }
499 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
500 | extdefs lang_extdef
501 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
510 { have_extern_spec
= 1;
511 used_extern_spec
= 0;
512 $
<ttype
>$
= NULL_TREE
; }
515 { have_extern_spec
= 0; }
529 { if
(pending_lang_change
) do_pending_lang_change
();
530 type_lookups
= NULL_TREE
; }
532 { if
(! toplevel_bindings_p
())
537 fndef eat_saved_input
538 { do_pending_inlines
(); }
540 { do_pending_inlines
(); }
543 { warning
("keyword `export' not implemented, and will be ignored"); }
545 { do_pending_inlines
(); }
547 { do_pending_inlines
(); }
548 | asm_keyword
'(' STRING
')' ';'
549 { assemble_asm
($3); }
550 | extern_lang_string
'{' extdefs_opt
'}'
551 { pop_lang_context
(); }
552 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
553 { do_pending_inlines
(); pop_lang_context
(); }
554 | extern_lang_string .hush_warning datadef .warning_ok
555 { do_pending_inlines
(); pop_lang_context
(); }
556 | NAMESPACE identifier
'{'
557 { push_namespace
($2); }
559 { pop_namespace
(); }
561 { push_namespace
(NULL_TREE
); }
563 { pop_namespace
(); }
566 { do_toplevel_using_decl
($1); }
573 NAMESPACE identifier
'='
574 { begin_only_namespace_names
(); }
577 end_only_namespace_names
();
580 do_namespace_alias
($2, $5);
587 | USING global_scope qualified_id
589 | USING global_scope unqualified_id
593 namespace_using_decl:
594 USING namespace_qualifier identifier
595 { $$
= build_nt
(SCOPE_REF
, $2, $3); }
596 | USING global_scope identifier
597 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $3); }
598 | USING global_scope namespace_qualifier identifier
599 { $$
= build_nt
(SCOPE_REF
, $3, $4); }
604 { begin_only_namespace_names
(); }
607 end_only_namespace_names
();
608 /* If no declaration was found, the using-directive is
609 invalid. Since that was not reported, we need the
610 identifier for the error message. */
611 if
(TREE_CODE
($4) == IDENTIFIER_NODE
&& lastiddecl
)
613 do_using_directive
($4);
620 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
624 | namespace_qualifier NSNAME SCOPE
627 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
636 | global_scope qualified_id
638 | global_scope unqualified_id
644 { push_lang_context
($1); }
645 | extern_lang_string EXTERN_LANG_STRING
646 { if
(current_lang_name
!= $2)
647 error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name
);
648 pop_lang_context
(); push_lang_context
($2); }
651 template_parm_header:
653 { begin_template_parm_list
(); }
654 template_parm_list
'>'
655 { $$
= end_template_parm_list
($4); }
658 template_spec_header:
660 { begin_specialization
();
666 | template_spec_header
671 { $$
= process_template_parm
(NULL_TREE
, $1); }
672 | template_parm_list
',' template_parm
673 { $$
= process_template_parm
($1, $3); }
684 aggr maybe_identifier
685 { $$
= finish_template_type_parm
($1, $2); }
686 | TYPENAME_KEYWORD maybe_identifier
687 { $$
= finish_template_type_parm
(class_type_node
, $2); }
690 template_template_parm:
691 template_parm_header aggr maybe_identifier
692 { $$
= finish_template_template_parm
($2, $3); }
696 /* The following rules introduce a new reduce/reduce
697 conflict on the ',' and '>' input tokens: they are valid
698 prefixes for a `structsp', which means they could match a
699 nameless parameter. See 14.6, paragraph 3.
700 By putting them before the `parm' rule, we get
701 their match before considering them nameless parameter
704 { $$
= build_tree_list
(NULL_TREE
, $1); }
705 | template_type_parm
'=' type_id
706 { $$
= build_tree_list
(groktypename
($3.t
), $1); }
708 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
709 | parm
'=' expr_no_comma_rangle
710 { $$
= build_tree_list
($3, $1.t
); }
711 | template_template_parm
712 { $$
= build_tree_list
(NULL_TREE
, $1); }
713 | template_template_parm
'=' template_arg
715 if
(TREE_CODE
($3) != TEMPLATE_DECL
716 && TREE_CODE
($3) != TEMPLATE_TEMPLATE_PARM
717 && TREE_CODE
($3) != TYPE_DECL
718 && TREE_CODE
($3) != UNBOUND_CLASS_TEMPLATE
)
720 error ("invalid default template argument");
721 $3 = error_mark_node
;
723 $$
= build_tree_list
($3, $1);
728 template_header template_extdef
729 { finish_template_decl
($1); }
730 | template_header
error %prec EMPTY
731 { finish_template_decl
($1); }
735 fndef eat_saved_input
736 { do_pending_inlines
(); }
738 { do_pending_inlines
(); }
740 { do_pending_inlines
(); }
741 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
742 { do_pending_inlines
();
743 pop_lang_context
(); }
744 | extern_lang_string .hush_warning template_datadef .warning_ok
745 { do_pending_inlines
();
746 pop_lang_context
(); }
747 | extension template_extdef
753 | declmods notype_initdecls
';'
755 | typed_declspecs initdecls
';'
756 { note_list_got_semicolon
($1.t
); }
759 if
($1.t
!= error_mark_node
)
761 maybe_process_partial_specialization
($1.t
);
762 note_got_semicolon
($1.t
);
769 | declmods notype_initdecls
';'
771 | typed_declspecs initdecls
';'
772 { note_list_got_semicolon
($1.t
); }
774 { pedwarn
("empty declaration"); }
775 | explicit_instantiation
';'
776 | typed_declspecs
';'
779 split_specs_attrs
($1.t
, &t
, &attrs
);
781 note_list_got_semicolon
($1.t
);
785 |
error END_OF_SAVED_INPUT
791 ctor_initializer_opt:
807 /* The outermost block of a function really begins before the
808 mem-initializer-list, so we open one there and suppress the one that
809 actually corresponds to the curly braces. */
811 begin_function_body_ ctor_initializer_opt save_lineno
'{'
812 { $
<ttype
>$
= begin_compound_stmt
(/*has_no_scope=*/1); }
815 STMT_LINENO
($
<ttype
>5) = $3;
816 finish_compound_stmt
(/*has_no_scope=*/1, $
<ttype
>5);
817 finish_function_body
($1);
822 fn.def1 maybe_return_init function_body
823 { expand_body
(finish_function
(0)); }
824 | fn.def1 maybe_return_init function_try_block
825 { expand_body
(finish_function
(0)); }
826 | fn.def1 maybe_return_init
error
830 constructor_declarator:
831 nested_name_specifier SELFNAME
'('
832 { $$
= begin_constructor_declarator
($1, $2); }
833 parmlist
')' cv_qualifiers exception_specification_opt
834 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
835 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
836 { $$
= begin_constructor_declarator
($1, $2);
837 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
839 | global_scope nested_name_specifier SELFNAME
'('
840 { $$
= begin_constructor_declarator
($2, $3); }
841 parmlist
')' cv_qualifiers exception_specification_opt
842 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
843 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
844 { $$
= begin_constructor_declarator
($2, $3);
845 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
847 | nested_name_specifier self_template_type
'('
848 { $$
= begin_constructor_declarator
($1, $2); }
849 parmlist
')' cv_qualifiers exception_specification_opt
850 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
851 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
852 { $$
= begin_constructor_declarator
($1, $2);
853 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
855 | global_scope nested_name_specifier self_template_type
'('
856 { $$
= begin_constructor_declarator
($2, $3); }
857 parmlist
')' cv_qualifiers exception_specification_opt
858 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
859 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
860 { $$
= begin_constructor_declarator
($2, $3);
861 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
866 typed_declspecs declarator
867 { check_for_new_type
("return type", $1);
868 if
(!begin_function_definition
($1.t
, $2))
870 | declmods notype_declarator
871 { if
(!begin_function_definition
($1.t
, $2))
874 { if
(!begin_function_definition
(NULL_TREE
, $1))
876 | declmods constructor_declarator
877 { if
(!begin_function_definition
($1.t
, $2))
879 | constructor_declarator
880 { if
(!begin_function_definition
(NULL_TREE
, $1))
884 /* ANSI allows optional parentheses around constructor class names.
885 See ISO/IEC 14882:1998(E) 12.1. */
887 component_constructor_declarator:
888 SELFNAME
'(' parmlist
')' cv_qualifiers exception_specification_opt
889 { $$
= make_call_declarator
($1, $3, $5, $6); }
890 |
'(' SELFNAME
')' '(' parmlist
')' cv_qualifiers
891 exception_specification_opt
892 { $$
= make_call_declarator
($2, $5, $7, $8); }
893 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
894 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
895 |
'(' SELFNAME
')' LEFT_RIGHT cv_qualifiers exception_specification_opt
896 { $$
= make_call_declarator
($2, empty_parms
(), $5, $6); }
897 | self_template_type
'(' parmlist
')' cv_qualifiers exception_specification_opt
898 { $$
= make_call_declarator
($1, $3, $5, $6); }
899 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
900 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
903 /* more C++ complexity. See component_decl for a comment on the
904 reduce/reduce conflict introduced by these rules. */
906 declmods component_constructor_declarator
907 { $$
= parse_method
($2, $1.t
, $1.lookups
);
911 if
(yychar == YYEMPTY
)
914 | component_constructor_declarator
915 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
917 | typed_declspecs declarator
918 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
919 | declmods notype_declarator
920 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
922 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
924 | declmods constructor_declarator
925 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
926 | constructor_declarator
927 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
932 RETURN_KEYWORD IDENTIFIER
940 { finish_named_return_value
($
<ttype
>$
, $2); }
941 | return_id
'(' nonnull_exprlist
')'
942 { finish_named_return_value
($
<ttype
>$
, $3); }
943 | return_id LEFT_RIGHT
944 { finish_named_return_value
($
<ttype
>$
, NULL_TREE
); }
950 if
(! DECL_CONSTRUCTOR_P
(current_function_decl
))
951 error ("only constructors take base initializers");
952 else if
($2.new_type_flag
== 0)
953 error ("no base or member initializers given following ':'");
955 finish_mem_initializers
($2.t
);
959 begin_function_body_:
962 $$
= begin_function_body
();
969 $$.new_type_flag
= 0;
974 $$.new_type_flag
= 1;
977 | member_init_list
',' member_init
981 $$.new_type_flag
= 1;
982 TREE_CHAIN
($3) = $1.t
;
988 | member_init_list
error
992 '(' nonnull_exprlist
')'
994 if
(current_class_name
)
995 pedwarn
("anachronistic old style base class initializer");
996 $$
= expand_member_init
(current_class_ref
, NULL_TREE
, $2);
1000 if
(current_class_name
)
1001 pedwarn
("anachronistic old style base class initializer");
1002 $$
= expand_member_init
(current_class_ref
,
1006 | notype_identifier
'(' nonnull_exprlist
')'
1007 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
1008 | notype_identifier LEFT_RIGHT
1009 { $$
= expand_member_init
(current_class_ref
, $1,
1011 | nonnested_type
'(' nonnull_exprlist
')'
1012 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
1013 | nonnested_type LEFT_RIGHT
1014 { $$
= expand_member_init
(current_class_ref
, $1,
1016 | typename_sub
'(' nonnull_exprlist
')'
1017 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
1018 | typename_sub LEFT_RIGHT
1019 { $$
= expand_member_init
(current_class_ref
, $1,
1036 | NSNAME %prec EMPTY
1045 explicit_instantiation:
1046 TEMPLATE begin_explicit_instantiation typespec
';'
1047 { do_type_instantiation
($3.t
, NULL_TREE
, 1);
1048 yyungetc
(';', 1); }
1049 end_explicit_instantiation
1050 | TEMPLATE begin_explicit_instantiation typed_declspecs declarator
1051 { tree specs
= strip_attrs
($3.t
);
1052 do_decl_instantiation
(specs
, $4, NULL_TREE
); }
1053 end_explicit_instantiation
1054 | TEMPLATE begin_explicit_instantiation notype_declarator
1055 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
1056 end_explicit_instantiation
1057 | TEMPLATE begin_explicit_instantiation constructor_declarator
1058 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
1059 end_explicit_instantiation
1060 | SCSPEC TEMPLATE begin_explicit_instantiation typespec
';'
1061 { do_type_instantiation
($4.t
, $1, 1);
1062 yyungetc
(';', 1); }
1063 end_explicit_instantiation
1065 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
1067 { tree specs
= strip_attrs
($4.t
);
1068 do_decl_instantiation
(specs
, $5, $1); }
1069 end_explicit_instantiation
1071 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
1072 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1073 end_explicit_instantiation
1075 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
1076 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1077 end_explicit_instantiation
1081 begin_explicit_instantiation:
1082 { begin_explicit_instantiation
(); }
1085 end_explicit_instantiation:
1086 { end_explicit_instantiation
(); }
1089 /* The TYPENAME expansions are to deal with use of a template class name as
1090 a template within the class itself, where the template decl is hidden by
1091 a type decl. Got all that? */
1094 PTYPENAME
'<' template_arg_list_opt template_close_bracket
1095 finish_template_type_
1097 | tTYPENAME
'<' template_arg_list_opt template_close_bracket
1098 finish_template_type_
1100 | self_template_type
1103 apparent_template_type:
1105 | identifier
'<' template_arg_list_opt
'>'
1106 finish_template_type_
1111 SELFNAME
'<' template_arg_list_opt template_close_bracket
1112 finish_template_type_
1116 finish_template_type_:
1118 if
(yychar == YYEMPTY
)
1121 $$
= finish_template_type
($
<ttype
>-3, $
<ttype
>-1,
1126 template_close_bracket:
1130 /* Handle `Class<Class<Type>>' without space in the `>>' */
1131 pedwarn
("`>>' should be `> >' in template class name");
1136 template_arg_list_opt:
1144 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1145 | template_arg_list
',' template_arg
1146 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1151 { $$
= groktypename
($1.t
); }
1155 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1156 $$
= TREE_TYPE
($$
);
1158 | global_scope PTYPENAME
1161 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1162 $$
= TREE_TYPE
($$
);
1164 | expr_no_comma_rangle
1165 | nested_name_specifier TEMPLATE identifier
1167 if
(!processing_template_decl
)
1169 error ("use of template qualifier outside template");
1170 $$
= error_mark_node
;
1173 $$
= make_unbound_class_template
($1, $3, 1);
1179 { $$
= NEGATE_EXPR
; }
1181 { $$
= CONVERT_EXPR
; }
1183 { $$
= PREINCREMENT_EXPR
; }
1185 { $$
= PREDECREMENT_EXPR
; }
1187 { $$
= TRUTH_NOT_EXPR
; }
1192 { $$
= build_x_compound_expr
($$
); }
1198 { error ("ISO C++ forbids an empty condition for `%s'",
1200 $$
= integer_zero_node
; }
1207 { error ("ISO C++ forbids an empty condition for `%s'",
1209 $$
= integer_zero_node
; }
1223 type_specifier_seq declarator maybeasm maybe_attribute
'='
1226 for
(d
= getdecls
(); d
; d
= TREE_CHAIN
(d
))
1227 if
(TREE_CODE
(d
) == TYPE_DECL
) {
1228 tree s
= TREE_TYPE
(d
);
1229 if
(TREE_CODE
(s
) == RECORD_TYPE
)
1230 error ("definition of class `%T' in condition", s
);
1231 else if
(TREE_CODE
(s
) == ENUMERAL_TYPE
)
1232 error ("definition of enum `%T' in condition", s
);
1235 current_declspecs
= $1.t
;
1236 $
<ttype
>$
= parse_decl
($
<ttype
>2, $4, 1);
1240 parse_end_decl
($
<ttype
>6, $7, $4);
1241 $$
= convert_from_reference
($
<ttype
>6);
1242 if
(TREE_CODE
(TREE_TYPE
($$
)) == ARRAY_TYPE
)
1243 error ("definition of array `%#D' in condition", $$
);
1250 | maybe_label_decls stmts
'}'
1251 | maybe_label_decls stmts
error '}'
1252 | maybe_label_decls
error '}'
1255 nontrivial_exprlist:
1256 expr_no_commas
',' expr_no_commas
1257 { $$
= tree_cons
(NULL_TREE
, $$
,
1258 build_tree_list
(NULL_TREE
, $3)); }
1259 | expr_no_commas
',' error
1260 { $$
= tree_cons
(NULL_TREE
, $$
,
1261 build_tree_list
(NULL_TREE
, error_mark_node
)); }
1262 | nontrivial_exprlist
',' expr_no_commas
1263 { chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1264 | nontrivial_exprlist
',' error
1265 { chainon
($$
, build_tree_list
(NULL_TREE
, error_mark_node
)); }
1270 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1271 | nontrivial_exprlist
1277 /* __extension__ turns off -pedantic for following primary. */
1278 | extension cast_expr %prec UNARY
1281 |
'*' cast_expr %prec UNARY
1282 { $$
= build_x_indirect_ref
($2, "unary *"); }
1283 |
'&' cast_expr %prec UNARY
1284 { $$
= build_x_unary_op
(ADDR_EXPR
, $2); }
1286 { $$
= build_x_unary_op
(BIT_NOT_EXPR
, $2); }
1287 | unop cast_expr %prec UNARY
1288 { $$
= finish_unary_op_expr
($1, $2); }
1289 /* Refer to the address of a label as a pointer. */
1291 { $$
= finish_label_address_expr
($2); }
1292 | SIZEOF unary_expr %prec UNARY
1293 { $$
= finish_sizeof
($2); }
1294 | SIZEOF
'(' type_id
')' %prec HYPERUNARY
1295 { $$
= finish_sizeof
(groktypename
($3.t
));
1296 check_for_new_type
("sizeof", $3); }
1297 | ALIGNOF unary_expr %prec UNARY
1298 { $$
= finish_alignof
($2); }
1299 | ALIGNOF
'(' type_id
')' %prec HYPERUNARY
1300 { $$
= finish_alignof
(groktypename
($3.t
));
1301 check_for_new_type
("alignof", $3); }
1303 /* The %prec EMPTY's here are required by the = init initializer
1304 syntax extension; see below. */
1305 | new new_type_id %prec EMPTY
1306 { $$
= build_new
(NULL_TREE
, $2.t
, NULL_TREE
, $1);
1307 check_for_new_type
("new", $2); }
1308 | new new_type_id new_initializer
1309 { $$
= build_new
(NULL_TREE
, $2.t
, $3, $1);
1310 check_for_new_type
("new", $2); }
1311 | new new_placement new_type_id %prec EMPTY
1312 { $$
= build_new
($2, $3.t
, NULL_TREE
, $1);
1313 check_for_new_type
("new", $3); }
1314 | new new_placement new_type_id new_initializer
1315 { $$
= build_new
($2, $3.t
, $4, $1);
1316 check_for_new_type
("new", $3); }
1317 | new
'(' type_id
')'
1319 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
),
1321 check_for_new_type
("new", $3); }
1322 | new
'(' type_id
')' new_initializer
1323 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
), $5, $1);
1324 check_for_new_type
("new", $3); }
1325 | new new_placement
'(' type_id
')' %prec EMPTY
1326 { $$
= build_new
($2, groktypename
($4.t
), NULL_TREE
, $1);
1327 check_for_new_type
("new", $4); }
1328 | new new_placement
'(' type_id
')' new_initializer
1329 { $$
= build_new
($2, groktypename
($4.t
), $6, $1);
1330 check_for_new_type
("new", $4); }
1332 | delete cast_expr %prec UNARY
1333 { $$
= delete_sanity
($2, NULL_TREE
, 0, $1); }
1334 | delete
'[' ']' cast_expr %prec UNARY
1335 { $$
= delete_sanity
($4, NULL_TREE
, 1, $1);
1336 if
(yychar == YYEMPTY
)
1338 | delete
'[' expr
']' cast_expr %prec UNARY
1339 { $$
= delete_sanity
($5, $3, 2, $1);
1340 if
(yychar == YYEMPTY
)
1342 | REALPART cast_expr %prec UNARY
1343 { $$
= build_x_unary_op
(REALPART_EXPR
, $2); }
1344 | IMAGPART cast_expr %prec UNARY
1345 { $$
= build_x_unary_op
(IMAGPART_EXPR
, $2); }
1349 '(' nonnull_exprlist
')'
1351 |
'{' nonnull_exprlist
'}'
1352 { pedwarn
("old style placement syntax, use () instead");
1357 '(' nonnull_exprlist
')'
1360 { $$
= void_zero_node
; }
1363 error ("`%T' is not a valid expression", $2.t
);
1364 $$
= error_mark_node
;
1366 /* GNU extension so people can use initializer lists. Note that
1367 this alters the meaning of `new int = 1', which was previously
1368 syntactically valid but semantically invalid.
1369 This feature is now deprecated and will be removed in a future
1374 pedwarn
("ISO C++ forbids initialization of new expression with `='");
1375 cp_deprecated
("new initializer lists extension");
1376 if
(TREE_CODE
($2) != TREE_LIST
1377 && TREE_CODE
($2) != CONSTRUCTOR
)
1378 $$
= build_tree_list
(NULL_TREE
, $2);
1384 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1386 '(' type_id
')' %prec EMPTY
1387 { $2.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $2.t
), 0);
1388 $$
= make_call_declarator
(NULL_TREE
, $2.t
, NULL_TREE
, NULL_TREE
);
1389 check_for_new_type
("cast", $2); }
1390 | regcast_or_absdcl
'(' type_id
')' %prec EMPTY
1391 { $3.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $3.t
), 0);
1392 $$
= make_call_declarator
($$
, $3.t
, NULL_TREE
, NULL_TREE
);
1393 check_for_new_type
("cast", $3); }
1398 | regcast_or_absdcl unary_expr %prec UNARY
1399 { $$
= reparse_absdcl_as_casts
($$
, $2); }
1400 | regcast_or_absdcl
'{' initlist maybecomma
'}' %prec UNARY
1402 tree init
= build_nt
(CONSTRUCTOR
, NULL_TREE
,
1405 pedwarn
("ISO C++ forbids compound literals");
1406 /* Indicate that this was a C99 compound literal. */
1407 TREE_HAS_CONSTRUCTOR
(init
) = 1;
1409 $$
= reparse_absdcl_as_casts
($$
, init
);
1415 /* Handle general members. */
1416 | expr_no_commas POINTSAT_STAR expr_no_commas
1417 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1418 | expr_no_commas DOT_STAR expr_no_commas
1419 { $$
= build_m_component_ref
($$
, $3); }
1420 | expr_no_commas
'+' expr_no_commas
1421 { $$
= build_x_binary_op
($2, $$
, $3); }
1422 | expr_no_commas
'-' expr_no_commas
1423 { $$
= build_x_binary_op
($2, $$
, $3); }
1424 | expr_no_commas
'*' expr_no_commas
1425 { $$
= build_x_binary_op
($2, $$
, $3); }
1426 | expr_no_commas
'/' expr_no_commas
1427 { $$
= build_x_binary_op
($2, $$
, $3); }
1428 | expr_no_commas
'%' expr_no_commas
1429 { $$
= build_x_binary_op
($2, $$
, $3); }
1430 | expr_no_commas LSHIFT expr_no_commas
1431 { $$
= build_x_binary_op
($2, $$
, $3); }
1432 | expr_no_commas RSHIFT expr_no_commas
1433 { $$
= build_x_binary_op
($2, $$
, $3); }
1434 | expr_no_commas ARITHCOMPARE expr_no_commas
1435 { $$
= build_x_binary_op
($2, $$
, $3); }
1436 | expr_no_commas
'<' expr_no_commas
1437 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1438 | expr_no_commas
'>' expr_no_commas
1439 { $$
= build_x_binary_op
(GT_EXPR
, $$
, $3); }
1440 | expr_no_commas EQCOMPARE expr_no_commas
1441 { $$
= build_x_binary_op
($2, $$
, $3); }
1442 | expr_no_commas MIN_MAX expr_no_commas
1443 { $$
= build_x_binary_op
($2, $$
, $3); }
1444 | expr_no_commas
'&' expr_no_commas
1445 { $$
= build_x_binary_op
($2, $$
, $3); }
1446 | expr_no_commas
'|' expr_no_commas
1447 { $$
= build_x_binary_op
($2, $$
, $3); }
1448 | expr_no_commas
'^' expr_no_commas
1449 { $$
= build_x_binary_op
($2, $$
, $3); }
1450 | expr_no_commas ANDAND expr_no_commas
1451 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1452 | expr_no_commas OROR expr_no_commas
1453 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1454 | expr_no_commas
'?' xexpr
':' expr_no_commas
1455 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1456 | expr_no_commas
'=' expr_no_commas
1457 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1458 if
($$
!= error_mark_node
)
1459 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1460 | expr_no_commas ASSIGN expr_no_commas
1461 { $$
= build_x_modify_expr
($$
, $2, $3); }
1463 { $$
= build_throw
(NULL_TREE
); }
1464 | THROW expr_no_commas
1465 { $$
= build_throw
($2); }
1468 expr_no_comma_rangle:
1470 /* Handle general members. */
1471 | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
1472 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1473 | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
1474 { $$
= build_m_component_ref
($$
, $3); }
1475 | expr_no_comma_rangle
'+' expr_no_comma_rangle
1476 { $$
= build_x_binary_op
($2, $$
, $3); }
1477 | expr_no_comma_rangle
'-' expr_no_comma_rangle
1478 { $$
= build_x_binary_op
($2, $$
, $3); }
1479 | expr_no_comma_rangle
'*' expr_no_comma_rangle
1480 { $$
= build_x_binary_op
($2, $$
, $3); }
1481 | expr_no_comma_rangle
'/' expr_no_comma_rangle
1482 { $$
= build_x_binary_op
($2, $$
, $3); }
1483 | expr_no_comma_rangle
'%' expr_no_comma_rangle
1484 { $$
= build_x_binary_op
($2, $$
, $3); }
1485 | expr_no_comma_rangle LSHIFT expr_no_comma_rangle
1486 { $$
= build_x_binary_op
($2, $$
, $3); }
1487 | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
1488 { $$
= build_x_binary_op
($2, $$
, $3); }
1489 | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
1490 { $$
= build_x_binary_op
($2, $$
, $3); }
1491 | expr_no_comma_rangle
'<' expr_no_comma_rangle
1492 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1493 | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
1494 { $$
= build_x_binary_op
($2, $$
, $3); }
1495 | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
1496 { $$
= build_x_binary_op
($2, $$
, $3); }
1497 | expr_no_comma_rangle
'&' expr_no_comma_rangle
1498 { $$
= build_x_binary_op
($2, $$
, $3); }
1499 | expr_no_comma_rangle
'|' expr_no_comma_rangle
1500 { $$
= build_x_binary_op
($2, $$
, $3); }
1501 | expr_no_comma_rangle
'^' expr_no_comma_rangle
1502 { $$
= build_x_binary_op
($2, $$
, $3); }
1503 | expr_no_comma_rangle ANDAND expr_no_comma_rangle
1504 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1505 | expr_no_comma_rangle OROR expr_no_comma_rangle
1506 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1507 | expr_no_comma_rangle
'?' xexpr
':' expr_no_comma_rangle
1508 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1509 | expr_no_comma_rangle
'=' expr_no_comma_rangle
1510 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1511 if
($$
!= error_mark_node
)
1512 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1513 | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
1514 { $$
= build_x_modify_expr
($$
, $2, $3); }
1516 { $$
= build_throw
(NULL_TREE
); }
1517 | THROW expr_no_comma_rangle
1518 { $$
= build_throw
($2); }
1521 notype_unqualified_id:
1522 '~' see_typename identifier
1523 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1524 |
'~' see_typename template_type
1525 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1530 | NSNAME %prec EMPTY
1535 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1536 means that we're in an expression like S::f<int>, so
1537 don't do_identifier; we only do that for unqualified
1539 if
(!lastiddecl || TREE_CODE
(lastiddecl
) != TREE_LIST
)
1540 $$
= do_identifier
($
<ttype
>-1, 1, NULL_TREE
);
1547 PFUNCNAME
'<' do_id template_arg_list_opt template_close_bracket
1548 { $$
= lookup_template_function
($3, $4); }
1549 | operator_name
'<' do_id template_arg_list_opt template_close_bracket
1550 { $$
= lookup_template_function
($3, $4); }
1554 TEMPLATE identifier
'<' template_arg_list_opt template_close_bracket
1555 { $$
= lookup_template_function
($2, $4); }
1556 | TEMPLATE PFUNCNAME
'<' template_arg_list_opt template_close_bracket
1557 { $$
= lookup_template_function
($2, $4); }
1558 | TEMPLATE operator_name
'<' template_arg_list_opt
1559 template_close_bracket
1560 { $$
= lookup_template_function
($2, $4); }
1564 notype_unqualified_id
1569 expr_or_declarator_intern:
1571 | attributes expr_or_declarator
1573 /* Provide support for '(' attributes '*' declarator ')'
1575 $$
= tree_cons
($1, $2, NULL_TREE
);
1580 notype_unqualified_id
1581 |
'*' expr_or_declarator_intern %prec UNARY
1582 { $$
= build_nt
(INDIRECT_REF
, $2); }
1583 |
'&' expr_or_declarator_intern %prec UNARY
1584 { $$
= build_nt
(ADDR_EXPR
, $2); }
1585 |
'(' expr_or_declarator_intern
')'
1589 notype_template_declarator:
1590 IDENTIFIER
'<' template_arg_list_opt template_close_bracket
1591 { $$
= lookup_template_function
($1, $3); }
1592 | NSNAME
'<' template_arg_list template_close_bracket
1593 { $$
= lookup_template_function
($1, $3); }
1596 direct_notype_declarator:
1597 complex_direct_notype_declarator
1598 /* This precedence declaration is to prefer this reduce
1599 to the Koenig lookup shift in primary, below. I hate yacc. */
1600 | notype_unqualified_id %prec
'('
1601 | notype_template_declarator
1602 |
'(' expr_or_declarator_intern
')'
1603 { $$
= finish_decl_parsing
($2); }
1607 notype_unqualified_id
1609 if
(TREE_CODE
($1) == BIT_NOT_EXPR
)
1610 $$
= build_x_unary_op
(BIT_NOT_EXPR
, TREE_OPERAND
($1, 0));
1612 $$
= finish_id_expr
($1);
1618 $$
= fix_string_type
($$
);
1619 /* fix_string_type doesn't set up TYPE_MAIN_VARIANT of
1620 a const array the way we want, so fix it. */
1621 if
(flag_const_strings
)
1622 TREE_TYPE
($$
) = build_cplus_array_type
1623 (TREE_TYPE
(TREE_TYPE
($$
)),
1624 TYPE_DOMAIN
(TREE_TYPE
($$
)));
1627 { $$
= finish_fname
($1); }
1629 { $$
= finish_parenthesized_expr
($2); }
1630 |
'(' expr_or_declarator_intern
')'
1631 { $2 = reparse_decl_as_expr
(NULL_TREE
, $2);
1632 $$
= finish_parenthesized_expr
($2); }
1634 { $$
= error_mark_node
; }
1636 { if
(!at_function_scope_p
())
1638 error ("braced-group within expression allowed only inside a function");
1642 pedwarn
("ISO C++ forbids braced-groups within expressions");
1643 $
<ttype
>$
= begin_stmt_expr
();
1645 compstmt_or_stmtexpr
')'
1646 { $$
= finish_stmt_expr
($
<ttype
>2); }
1647 /* Koenig lookup support
1648 We could store lastiddecl in $1 to avoid another lookup,
1649 but that would result in many additional reduce/reduce conflicts. */
1650 | notype_unqualified_id
'(' nonnull_exprlist
')'
1651 { $$
= finish_call_expr
($1, $3, 1); }
1652 | notype_unqualified_id LEFT_RIGHT
1653 { $$
= finish_call_expr
($1, NULL_TREE
, 1); }
1654 | primary
'(' nonnull_exprlist
')'
1655 { $$
= finish_call_expr
($1, $3, 0); }
1656 | primary LEFT_RIGHT
1657 { $$
= finish_call_expr
($1, NULL_TREE
, 0); }
1658 | VA_ARG
'(' expr_no_commas
',' type_id
')'
1659 { $$
= build_x_va_arg
($3, groktypename
($5.t
));
1660 check_for_new_type
("__builtin_va_arg", $5); }
1661 | primary
'[' expr
']'
1662 { $$
= grok_array_decl
($$
, $3); }
1664 { $$
= finish_increment_expr
($1, POSTINCREMENT_EXPR
); }
1665 | primary MINUSMINUS
1666 { $$
= finish_increment_expr
($1, POSTDECREMENT_EXPR
); }
1667 /* C++ extensions */
1669 { $$
= finish_this_expr
(); }
1670 | CV_QUALIFIER
'(' nonnull_exprlist
')'
1672 /* This is a C cast in C++'s `functional' notation
1673 using the "implicit int" extension so that:
1674 `const (3)' is equivalent to `const int (3)'. */
1677 type
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1678 type
= groktypename
(build_tree_list
(type
, NULL_TREE
));
1679 $$
= build_functional_cast
(type
, $3);
1682 | DYNAMIC_CAST
'<' type_id
'>' '(' expr
')'
1683 { tree type
= groktypename
($3.t
);
1684 check_for_new_type
("dynamic_cast", $3);
1685 $$
= build_dynamic_cast
(type
, $6); }
1686 | STATIC_CAST
'<' type_id
'>' '(' expr
')'
1687 { tree type
= groktypename
($3.t
);
1688 check_for_new_type
("static_cast", $3);
1689 $$
= build_static_cast
(type
, $6); }
1690 | REINTERPRET_CAST
'<' type_id
'>' '(' expr
')'
1691 { tree type
= groktypename
($3.t
);
1692 check_for_new_type
("reinterpret_cast", $3);
1693 $$
= build_reinterpret_cast
(type
, $6); }
1694 | CONST_CAST
'<' type_id
'>' '(' expr
')'
1695 { tree type
= groktypename
($3.t
);
1696 check_for_new_type
("const_cast", $3);
1697 $$
= build_const_cast
(type
, $6); }
1698 | TYPEID
'(' expr
')'
1699 { $$
= build_typeid
($3); }
1700 | TYPEID
'(' type_id
')'
1701 { tree type
= groktypename
($3.t
);
1702 check_for_new_type
("typeid", $3);
1703 $$
= get_typeid
(type
); }
1704 | global_scope IDENTIFIER
1705 { $$
= parse_scoped_id
($2); }
1706 | global_scope template_id
1708 | global_scope operator_name
1710 got_scope
= NULL_TREE
;
1711 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
1712 $$
= parse_scoped_id
($2);
1716 | overqualified_id %prec HYPERUNARY
1717 { $$
= build_offset_ref
(OP0
($$
), OP1
($$
)); }
1718 | overqualified_id
'(' nonnull_exprlist
')'
1719 { $$
= finish_qualified_call_expr
($1, $3); }
1720 | overqualified_id LEFT_RIGHT
1721 { $$
= finish_qualified_call_expr
($1, NULL_TREE
); }
1722 | object object_template_id %prec UNARY
1724 $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1);
1726 | object object_template_id
'(' nonnull_exprlist
')'
1727 { $$
= finish_object_call_expr
($2, $1, $4); }
1728 | object object_template_id LEFT_RIGHT
1729 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1730 | object unqualified_id %prec UNARY
1731 { $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1); }
1732 | object overqualified_id %prec UNARY
1733 { if
(processing_template_decl
)
1734 $$
= build_min_nt
(COMPONENT_REF
, $1, $2);
1736 $$
= build_object_ref
($$
, OP0
($2), OP1
($2)); }
1737 | object unqualified_id
'(' nonnull_exprlist
')'
1738 { $$
= finish_object_call_expr
($2, $1, $4); }
1739 | object unqualified_id LEFT_RIGHT
1740 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1741 | object overqualified_id
'(' nonnull_exprlist
')'
1742 { $$
= finish_qualified_object_call_expr
($2, $1, $4); }
1743 | object overqualified_id LEFT_RIGHT
1744 { $$
= finish_qualified_object_call_expr
($2, $1, NULL_TREE
); }
1745 /* p->int::~int() is valid -- 12.4 */
1746 | object
'~' TYPESPEC LEFT_RIGHT
1747 { $$
= finish_pseudo_destructor_call_expr
($1, NULL_TREE
, $3); }
1748 | object TYPESPEC SCOPE
'~' TYPESPEC LEFT_RIGHT
1749 { $$
= finish_pseudo_destructor_call_expr
($1, $2, $5); }
1752 $$
= error_mark_node
;
1756 /* Not needed for now.
1762 { $$ = error_mark_node; }
1764 { if (current_function_decl == 0)
1766 error ("braced-group within expression allowed only inside a function");
1769 $<ttype>$ = expand_start_stmt_expr (); }
1770 compstmt_or_stmtexpr ')'
1772 pedwarn ("ISO C++ forbids braced-groups within expressions");
1773 $$ = expand_end_stmt_expr ($<ttype>2); }
1774 | primary_no_id '(' nonnull_exprlist ')'
1775 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1776 | primary_no_id LEFT_RIGHT
1777 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1778 | primary_no_id '[' expr ']'
1780 | primary_no_id PLUSPLUS
1781 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1782 | primary_no_id MINUSMINUS
1783 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1785 { goto do_scoped_id; }
1786 | SCOPE operator_name
1787 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1789 goto do_scoped_operator;
1798 { got_scope
= NULL_TREE
; $$
= 1; }
1804 | global_scope delete
1805 { got_scope
= NULL_TREE
; $$
= 1; }
1810 { $$
= boolean_true_node
; }
1812 { $$
= boolean_false_node
; }
1818 if
(DECL_CONSTRUCTOR_P
(current_function_decl
))
1819 finish_mem_initializers
(NULL_TREE
);
1825 { got_object
= TREE_TYPE
($$
); }
1828 $$
= build_x_arrow
($$
);
1829 got_object
= TREE_TYPE
($$
);
1834 typespec initdecls
';'
1836 if
($1.t
&& IS_AGGR_TYPE_CODE
(TREE_CODE
($1.t
)))
1837 note_got_semicolon
($1.t
);
1839 | typed_declspecs initdecls
';'
1841 note_list_got_semicolon
($1.t
);
1843 | declmods notype_initdecls
';'
1845 | typed_declspecs
';'
1848 note_list_got_semicolon
($1.t
);
1851 { warning
("empty declaration"); }
1856 /* Any kind of declarator (thus, all declarators allowed
1857 after an explicit typespec). */
1860 after_type_declarator %prec EMPTY
1861 | notype_declarator %prec EMPTY
1864 /* This is necessary to postpone reduction of `int()()()()'. */
1866 LEFT_RIGHT %prec EMPTY
1867 { $$
= make_call_declarator
(NULL_TREE
, empty_parms
(),
1868 NULL_TREE
, NULL_TREE
); }
1869 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1870 { $$
= make_call_declarator
($$
, empty_parms
(), NULL_TREE
,
1874 /* ISO type-id (8.1) */
1876 typed_typespecs absdcl
1877 { $$.t
= build_tree_list
($1.t
, $2);
1878 $$.new_type_flag
= $1.new_type_flag
; }
1879 | nonempty_cv_qualifiers absdcl
1880 { $$.t
= build_tree_list
($1.t
, $2);
1881 $$.new_type_flag
= $1.new_type_flag
; }
1883 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
1885 $$.new_type_flag
= $1.new_type_flag
; }
1886 | typed_typespecs %prec EMPTY
1887 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1888 $$.new_type_flag
= $1.new_type_flag
; }
1889 | nonempty_cv_qualifiers %prec EMPTY
1890 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1891 $$.new_type_flag
= $1.new_type_flag
; }
1894 /* Declspecs which contain at least one type specifier or typedef name.
1895 (Just `const' or `volatile' is not enough.)
1896 A typedef'd name following these is taken as a name to be declared.
1897 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1900 typed_typespecs %prec EMPTY
1901 { $$.lookups
= type_lookups
; }
1903 { $$.lookups
= type_lookups
; }
1908 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1909 $$.new_type_flag
= $2.new_type_flag
; }
1910 | typespec reserved_declspecs %prec HYPERUNARY
1911 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1912 $$.new_type_flag
= $1.new_type_flag
; }
1913 | typespec reserved_typespecquals reserved_declspecs
1914 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, chainon
($2, $3));
1915 $$.new_type_flag
= $1.new_type_flag
; }
1916 | declmods typespec reserved_declspecs
1917 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1918 $$.new_type_flag
= $2.new_type_flag
; }
1919 | declmods typespec reserved_typespecquals
1920 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1921 $$.new_type_flag
= $2.new_type_flag
; }
1922 | declmods typespec reserved_typespecquals reserved_declspecs
1923 { $$.t
= tree_cons
(NULL_TREE
, $2.t
,
1924 chainon
($3, chainon
($4, $1.t
)));
1925 $$.new_type_flag
= $2.new_type_flag
; }
1930 { if
(extra_warnings
)
1931 warning
("`%s' is not at beginning of declaration",
1932 IDENTIFIER_POINTER
($$
));
1933 $$
= build_tree_list
(NULL_TREE
, $$
); }
1934 | reserved_declspecs typespecqual_reserved
1935 { $$
= tree_cons
(NULL_TREE
, $2.t
, $$
); }
1936 | reserved_declspecs SCSPEC
1937 { if
(extra_warnings
)
1938 warning
("`%s' is not at beginning of declaration",
1939 IDENTIFIER_POINTER
($2));
1940 $$
= tree_cons
(NULL_TREE
, $2, $$
); }
1943 /* List of just storage classes and type modifiers.
1944 A declaration can start with just this, but then it cannot be used
1945 to redeclare a typedef-name.
1946 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1948 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1949 up on a persistent obstack. Otherwise, they could appear at the
1950 beginning of something like
1952 static const struct { int foo () { } } b;
1954 and would be discarded after we finish compiling foo. We don't need to
1955 worry once we see a type. */
1958 nonempty_cv_qualifiers %prec EMPTY
1959 { $$.lookups
= NULL_TREE
; TREE_STATIC
($$.t
) = 1; }
1962 $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1963 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1965 | declmods CV_QUALIFIER
1967 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1968 TREE_STATIC
($$.t
) = 1;
1972 if
(extra_warnings
&& TREE_STATIC
($$.t
))
1973 warning
("`%s' is not at beginning of declaration",
1974 IDENTIFIER_POINTER
($2));
1975 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1976 TREE_STATIC
($$.t
) = TREE_STATIC
($1.t
);
1978 | declmods attributes
1979 { $$.t
= hash_tree_cons
($2, NULL_TREE
, $1.t
); }
1982 /* Used instead of declspecs where storage classes are not allowed
1983 (that is, for typenames and structure components).
1985 C++ can takes storage classes for structure components.
1986 Don't accept a typedef-name if anything but a modifier precedes it. */
1989 typespec %prec EMPTY
1990 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
1991 $$.new_type_flag
= $1.new_type_flag
; }
1992 | nonempty_cv_qualifiers typespec
1993 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1994 $$.new_type_flag
= $2.new_type_flag
; }
1995 | typespec reserved_typespecquals
1996 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1997 $$.new_type_flag
= $1.new_type_flag
; }
1998 | nonempty_cv_qualifiers typespec reserved_typespecquals
1999 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
2000 $$.new_type_flag
= $2.new_type_flag
; }
2003 reserved_typespecquals:
2004 typespecqual_reserved
2005 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
2006 | reserved_typespecquals typespecqual_reserved
2007 { $$
= tree_cons
(NULL_TREE
, $2.t
, $1); }
2008 | reserved_typespecquals attributes
2009 { $$
= tree_cons
($2, NULL_TREE
, $1); }
2010 | attributes %prec EMPTY
2011 { $$
= tree_cons
($1, NULL_TREE
, NULL_TREE
); }
2014 /* A typespec (but not a type qualifier).
2015 Once we have seen one of these in a declaration,
2016 if a typedef name appears then it is being redeclared. */
2020 { $$.lookups
= NULL_TREE
; }
2021 | TYPESPEC %prec EMPTY
2022 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
2023 | complete_type_name
2024 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
2025 | TYPEOF
'(' expr
')'
2026 { $$.t
= finish_typeof
($3);
2027 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
2028 | TYPEOF
'(' type_id
')'
2029 { $$.t
= groktypename
($3.t
);
2030 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
2031 | SIGOF
'(' expr
')'
2032 { tree type
= TREE_TYPE
($3);
2034 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2035 if
(IS_AGGR_TYPE
(type
))
2037 sorry
("sigof type specifier");
2042 error ("`sigof' applied to non-aggregate expression");
2043 $$.t
= error_mark_node
;
2046 | SIGOF
'(' type_id
')'
2047 { tree type
= groktypename
($3.t
);
2049 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2050 if
(IS_AGGR_TYPE
(type
))
2052 sorry
("sigof type specifier");
2057 error("`sigof' applied to non-aggregate type");
2058 $$.t
= error_mark_node
;
2063 /* A typespec that is a reserved word, or a type qualifier. */
2065 typespecqual_reserved:
2067 { $$.t
= $1; $$.new_type_flag
= 0; }
2069 { $$.t
= $1; $$.new_type_flag
= 0; }
2075 | initdecls
',' initdcl
2076 { check_multiple_declarators
(); }
2081 | notype_initdecls
',' initdcl
2082 { check_multiple_declarators
(); }
2087 | nomods_initdecls
',' initdcl
2088 { check_multiple_declarators
(); }
2094 | asm_keyword
'(' STRING
')'
2099 declarator maybeasm maybe_attribute
'='
2100 { $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 1); }
2102 /* Note how the declaration of the variable is in effect while its init is parsed! */
2103 { parse_end_decl
($
<ttype
>5, $6, $2); }
2104 | declarator maybeasm maybe_attribute
2106 $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 0);
2107 parse_end_decl
($
<ttype
>$
, NULL_TREE
, $2);
2111 /* This rule assumes a certain configuration of the parser stack.
2112 In particular, $0, the element directly before the beginning of
2113 this rule on the stack, must be a maybeasm. $-1 must be a
2114 declarator or notype_declarator. And $-2 must be some declmods
2115 or declspecs. We can't move the maybeasm into this rule because
2116 we need that reduce so we prefer fn.def1 when appropriate. */
2119 { $
<ttype
>$
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2120 $
<ftype
>-2.lookups
, $1, 1); }
2121 /* Note how the declaration of the variable is in effect
2122 while its init is parsed! */
2124 { parse_end_decl
($
<ttype
>3, $4, $
<ttype
>0); }
2126 { tree d
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2127 $
<ftype
>-2.lookups
, $1, 0);
2128 parse_end_decl
(d
, NULL_TREE
, $
<ttype
>0); }
2132 declarator maybeasm initdcl0_innards
2137 notype_declarator maybeasm initdcl0_innards
2142 notype_declarator maybeasm
2143 { /* Set things up as initdcl0_innards expects. */
2146 $
<ftype
>1.t
= NULL_TREE
;
2147 $
<ftype
>1.lookups
= NULL_TREE
; }
2150 | constructor_declarator maybeasm maybe_attribute
2151 { tree d
= parse_decl0
($1, NULL_TREE
, NULL_TREE
, $3, 0);
2152 parse_end_decl
(d
, NULL_TREE
, $2); }
2155 /* the * rules are dummies to accept the Apollo extended syntax
2156 so that the header files compile. */
2167 | attributes attribute
2168 { $$
= chainon
($1, $2); }
2172 ATTRIBUTE
'(' '(' attribute_list
')' ')'
2179 | attribute_list
',' attrib
2180 { $$
= chainon
($1, $3); }
2187 { $$
= build_tree_list
($1, NULL_TREE
); }
2188 | any_word
'(' IDENTIFIER
')'
2189 { $$
= build_tree_list
($1, build_tree_list
(NULL_TREE
, $3)); }
2190 | any_word
'(' IDENTIFIER
',' nonnull_exprlist
')'
2191 { $$
= build_tree_list
($1, tree_cons
(NULL_TREE
, $3, $5)); }
2192 | any_word
'(' nonnull_exprlist
')'
2193 { $$
= build_tree_list
($1, $3); }
2196 /* This still leaves out most reserved keywords,
2197 shouldn't we include them? */
2206 /* A nonempty list of identifiers, including typenames. */
2207 identifiers_or_typenames:
2209 { $$
= build_tree_list
(NULL_TREE
, $1); }
2210 | identifiers_or_typenames
',' identifier
2211 { $$
= chainon
($1, build_tree_list
(NULL_TREE
, $3)); }
2215 /* empty */ %prec EMPTY
2221 /* If we are processing a template, we don't want to expand this
2225 expr_no_commas %prec
'='
2227 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, NULL_TREE
);
2228 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2230 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2231 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2232 |
'{' initlist
',' '}'
2233 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2234 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2239 /* This chain is built in reverse order,
2240 and put in forward order where initlist is used. */
2243 { $$
= build_tree_list
(NULL_TREE
, $$
); }
2245 { $$
= tree_cons
(NULL_TREE
, $3, $$
); }
2246 /* These are for labeled elements. */
2247 |
'[' expr_no_commas
']' init
2248 { $$
= build_tree_list
($2, $4); }
2249 | identifier
':' init
2250 { $$
= build_tree_list
($$
, $3); }
2251 | initlist
',' identifier
':' init
2252 { $$
= tree_cons
($3, $5, $$
); }
2256 PRE_PARSED_FUNCTION_DECL maybe_return_init function_body
2258 expand_body
(finish_function
(2));
2259 process_next_inline
($1);
2261 | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
2263 expand_body
(finish_function
(2));
2264 process_next_inline
($1);
2266 | PRE_PARSED_FUNCTION_DECL maybe_return_init
error
2268 finish_function
(2);
2269 process_next_inline
($1); }
2274 | pending_inlines pending_inline eat_saved_input
2277 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2278 the TREE_LIST node for the parameter in question. */
2280 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2281 { replace_defarg
($1, $2); }
2282 | DEFARG_MARKER
error END_OF_SAVED_INPUT
2283 { replace_defarg
($1, error_mark_node
); }
2287 /* empty */ %prec EMPTY
2288 | pending_defargs defarg_again
2289 { do_pending_defargs
(); }
2290 | pending_defargs
error
2291 { do_pending_defargs
(); }
2296 { $
<ttype
>$
= current_enum_type
;
2297 current_enum_type
= start_enum
($2); }
2299 { $$.t
= current_enum_type
;
2300 finish_enum
(current_enum_type
);
2301 $$.new_type_flag
= 1;
2302 current_enum_type
= $
<ttype
>4;
2303 check_for_missing_semicolon
($$.t
); }
2305 { $
<ttype
>$
= current_enum_type
;
2306 current_enum_type
= start_enum
(make_anon_name
()); }
2308 { $$.t
= current_enum_type
;
2309 finish_enum
(current_enum_type
);
2310 $$.new_type_flag
= 1;
2311 current_enum_type
= $
<ttype
>3;
2312 check_for_missing_semicolon
($$.t
); }
2314 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2315 $$.new_type_flag
= 0; }
2316 | ENUM complex_type_name
2317 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2318 $$.new_type_flag
= 0; }
2319 | TYPENAME_KEYWORD typename_sub
2321 $$.new_type_flag
= 0;
2322 if
(!processing_template_decl
)
2323 pedwarn
("using `typename' outside of template"); }
2324 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2325 | class_head_defn maybe_base_class_list
'{'
2327 if
($2 && $1.t
!= error_mark_node
)
2329 tree type
= TREE_TYPE
($1.t
);
2331 if
(TREE_CODE
(type
) == TYPENAME_TYPE
)
2332 /* In a definition of a member class template,
2333 we will get here with an implicit typename,
2334 a TYPENAME_TYPE with a type. */
2335 type
= TREE_TYPE
(type
);
2336 maybe_process_partial_specialization
(type
);
2337 xref_basetypes
(current_aggr
, $1.t
, type
, $2);
2339 $1.t
= begin_class_definition
(TREE_TYPE
($1.t
));
2340 check_class_key
(current_aggr
, $1.t
);
2341 current_aggr
= NULL_TREE
; }
2342 opt.component_decl_list
'}' maybe_attribute
2347 if
(yychar == YYEMPTY
)
2349 semi
= yychar == ';';
2351 t
= finish_class_definition
($1.t
, $7, semi
, $1.new_type_flag
);
2354 /* restore current_aggr */
2355 current_aggr
= TREE_CODE
(t
) != RECORD_TYPE
2357 : CLASSTYPE_DECLARED_CLASS
(t
)
2358 ? class_type_node
: record_type_node
;
2362 done_pending_defargs
();
2363 begin_inline_definitions
();
2368 $$.new_type_flag
= 1;
2372 $$.t
= TREE_TYPE
($1.t
);
2373 $$.new_type_flag
= $1.new_type_flag
;
2374 check_class_key
(current_aggr
, $$.t
);
2386 { if
(pedantic
&& !in_system_header
)
2387 pedwarn
("comma at end of enumerator list"); }
2393 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2395 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2397 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2399 { error ("no body nor ';' separates two class, struct or union declarations"); }
2401 { $$
= build_tree_list
($2, $1); }
2408 $$
= build_tree_list
(NULL_TREE
, $2);
2410 | aggr nested_name_specifier identifier
2413 $$
= build_tree_list
($2, $3);
2415 | aggr global_scope nested_name_specifier identifier
2418 $$
= build_tree_list
($3, $4);
2420 | aggr global_scope identifier
2423 $$
= build_tree_list
(global_namespace
, $3);
2427 class_head_apparent_template:
2428 aggr apparent_template_type
2433 | aggr nested_name_specifier apparent_template_type
2438 | aggr global_scope nested_name_specifier apparent_template_type
2446 class_head %prec EMPTY
2448 $$.t
= handle_class_head
(current_aggr
,
2449 TREE_PURPOSE
($1), TREE_VALUE
($1),
2450 0, &$$.new_type_flag
);
2452 | aggr identifier_defn %prec EMPTY
2455 $$.t
= TYPE_MAIN_DECL
(xref_tag
(current_aggr
, $2, 0));
2456 $$.new_type_flag
= 1;
2458 | class_head_apparent_template %prec EMPTY
2461 $$.new_type_flag
= 0;
2469 $$.t
= handle_class_head
(current_aggr
,
2470 TREE_PURPOSE
($1), TREE_VALUE
($1),
2471 1, &$$.new_type_flag
);
2476 $$.t
= handle_class_head
(current_aggr
,
2477 TREE_PURPOSE
($1), TREE_VALUE
($1),
2478 1, &$$.new_type_flag
);
2480 | class_head_apparent_template
'{'
2484 $$.new_type_flag
= 0;
2485 if
(TREE_CODE
(TREE_TYPE
($1)) == RECORD_TYPE
)
2486 /* We might be specializing a template with a different
2488 CLASSTYPE_DECLARED_CLASS
(TREE_TYPE
($1))
2489 = (current_aggr
== class_type_node
);
2491 | class_head_apparent_template
':'
2495 $$.new_type_flag
= 0;
2496 if
(TREE_CODE
(TREE_TYPE
($1)) == RECORD_TYPE
)
2497 /* We might be specializing a template with a different
2499 CLASSTYPE_DECLARED_CLASS
(TREE_TYPE
($1))
2500 = (current_aggr
== class_type_node
);
2502 | aggr identifier_defn
'{'
2506 $$.t
= handle_class_head
(current_aggr
,
2508 1, &$$.new_type_flag
);
2510 | aggr identifier_defn
':'
2514 $$.t
= handle_class_head
(current_aggr
,
2516 1, &$$.new_type_flag
);
2521 $$.t
= TYPE_MAIN_DECL
(xref_tag
($1, make_anon_name
(), 0));
2522 $$.new_type_flag
= 0;
2527 maybe_base_class_list:
2531 { error ("no bases given following `:'");
2533 |
':' see_typename base_class_list
2539 | base_class_list
',' see_typename base_class
2540 { $$
= chainon
($$
, $4); }
2545 { $$
= finish_base_specifier
(access_default_node
, $1); }
2546 | base_class_access_list see_typename base_class_1
2547 { $$
= finish_base_specifier
($1, $3); }
2553 $$
= error_mark_node
; }
2555 { $$
= TREE_TYPE
($$
); }
2558 base_class_access_list:
2559 VISSPEC see_typename
2560 | SCSPEC see_typename
2561 { if
($1 != ridpointers
[(int)RID_VIRTUAL
])
2562 error ("`%D' access", $1);
2563 $$
= access_default_virtual_node
; }
2564 | base_class_access_list VISSPEC see_typename
2566 if
($1 != access_default_virtual_node
)
2567 error ("multiple access specifiers");
2568 else if
($2 == access_public_node
)
2569 $$
= access_public_virtual_node
;
2570 else if
($2 == access_protected_node
)
2571 $$
= access_protected_virtual_node
;
2572 else
/* $2 == access_private_node */
2573 $$
= access_private_virtual_node
;
2575 | base_class_access_list SCSPEC see_typename
2576 { if
($2 != ridpointers
[(int)RID_VIRTUAL
])
2577 error ("`%D' access", $2);
2578 else if
($$
== access_public_node
)
2579 $$
= access_public_virtual_node
;
2580 else if
($$
== access_protected_node
)
2581 $$
= access_protected_virtual_node
;
2582 else if
($$
== access_private_node
)
2583 $$
= access_private_virtual_node
;
2585 error ("multiple `virtual' specifiers");
2589 opt.component_decl_list
:
2590 | component_decl_list
2591 | opt.component_decl_list access_specifier component_decl_list
2592 | opt.component_decl_list access_specifier
2598 current_access_specifier
= $1;
2602 /* Note: we no longer warn about the semicolon after a component_decl_list.
2603 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2604 component_decl_list:
2607 finish_member_declaration
($1);
2608 current_aggr
= NULL_TREE
;
2609 reset_type_access_control
();
2611 | component_decl_list component_decl
2613 finish_member_declaration
($2);
2614 current_aggr
= NULL_TREE
;
2615 reset_type_access_control
();
2620 component_decl_1
';'
2621 | component_decl_1
'}'
2622 { error ("missing ';' before right brace");
2623 yyungetc
('}', 0); }
2624 /* C++: handle constructors, destructors and inline functions */
2625 /* note that INLINE is like a TYPESPEC */
2626 | fn_def2
':' /* base_init compstmt */
2627 { $$
= finish_method
($$
); }
2628 | fn_def2 TRY
/* base_init compstmt */
2629 { $$
= finish_method
($$
); }
2630 | fn_def2 RETURN_KEYWORD
/* base_init compstmt */
2631 { $$
= finish_method
($$
); }
2632 | fn_def2
'{' /* nodecls compstmt */
2633 { $$
= finish_method
($$
); }
2636 | extension component_decl
2639 | template_header component_decl
2642 $$
= finish_member_template_decl
($2);
2644 /* The component was already processed. */
2647 finish_template_decl
($1);
2649 | template_header typed_declspecs
';'
2651 $$
= finish_member_class_template
($2.t
);
2652 finish_template_decl
($1);
2659 /* Do not add a "typed_declspecs declarator" rule here for
2660 speed; we need to call grok_x_components for enums, so the
2661 speedup would be insignificant. */
2662 typed_declspecs components
2664 /* Most of the productions for component_decl only
2665 allow the creation of one new member, so we call
2666 finish_member_declaration in component_decl_list.
2667 For this rule and the next, however, there can be
2668 more than one member, e.g.:
2672 and we need the first member to be fully
2673 registered before the second is processed.
2674 Therefore, the rules for components take care of
2675 this processing. To avoid registering the
2676 components more than once, we send NULL_TREE up
2677 here; that lets finish_member_declaration know
2678 that there is nothing to do. */
2680 grok_x_components
($1.t
);
2683 | declmods notype_components
2686 grok_x_components
($1.t
);
2689 | notype_declarator maybeasm maybe_attribute maybe_init
2690 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2691 | constructor_declarator maybeasm maybe_attribute maybe_init
2692 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2693 |
':' expr_no_commas
2694 { $$
= grokbitfield
(NULL_TREE
, NULL_TREE
, $2); }
2698 /* These rules introduce a reduce/reduce conflict; in
2699 typedef int foo, bar;
2703 should "A::foo" be declared as a function or "A::bar" as a data
2704 member? In other words, is "bar" an after_type_declarator or a
2706 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2707 { tree specs
, attrs
;
2708 split_specs_attrs
($1.t
, &specs
, &attrs
);
2709 $$
= grokfield
($2, specs
, $5, $3,
2710 chainon
($4, attrs
)); }
2711 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2712 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2714 { $$
= do_class_using_decl
($1); }
2717 /* The case of exactly one component is handled directly by component_decl. */
2720 /* empty: possibly anonymous */
2722 | component_declarator0
2724 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2725 $1 = finish_member_template_decl
($1);
2726 finish_member_declaration
($1);
2729 | components
',' component_declarator
2731 check_multiple_declarators
();
2732 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2733 $3 = finish_member_template_decl
($3);
2734 finish_member_declaration
($3);
2740 /* empty: possibly anonymous */
2742 | notype_component_declarator0
2744 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2745 $1 = finish_member_template_decl
($1);
2746 finish_member_declaration
($1);
2749 | notype_components
',' notype_component_declarator
2751 check_multiple_declarators
();
2752 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2753 $3 = finish_member_template_decl
($3);
2754 finish_member_declaration
($3);
2759 component_declarator0:
2760 after_type_component_declarator0
2761 | notype_component_declarator0
2764 component_declarator:
2765 after_type_component_declarator
2766 | notype_component_declarator
2769 after_type_component_declarator0:
2770 after_type_declarator maybeasm maybe_attribute maybe_init
2771 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2773 | tTYPENAME
':' expr_no_commas maybe_attribute
2774 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2778 notype_component_declarator0:
2779 notype_declarator maybeasm maybe_attribute maybe_init
2780 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2782 | constructor_declarator maybeasm maybe_attribute maybe_init
2783 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2785 | IDENTIFIER
':' expr_no_commas maybe_attribute
2786 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2788 |
':' expr_no_commas maybe_attribute
2789 { $$
= parse_bitfield0
(NULL_TREE
, $
<ftype
>0.t
,
2790 $
<ftype
>0.lookups
, $3, $2); }
2793 after_type_component_declarator:
2794 after_type_declarator maybeasm maybe_attribute maybe_init
2795 { $$
= parse_field
($1, $3, $2, $4); }
2796 | tTYPENAME
':' expr_no_commas maybe_attribute
2797 { $$
= parse_bitfield
($1, $4, $3); }
2800 notype_component_declarator:
2801 notype_declarator maybeasm maybe_attribute maybe_init
2802 { $$
= parse_field
($1, $3, $2, $4); }
2803 | IDENTIFIER
':' expr_no_commas maybe_attribute
2804 { $$
= parse_bitfield
($1, $4, $3); }
2805 |
':' expr_no_commas maybe_attribute
2806 { $$
= parse_bitfield
(NULL_TREE
, $3, $2); }
2810 enumlist maybecomma_warn
2814 /* We chain the enumerators in reverse order.
2815 Because of the way enums are built, the order is
2816 insignificant. Take advantage of this fact. */
2820 | enumlist
',' enumerator
2825 { build_enumerator
($1, NULL_TREE
, current_enum_type
); }
2826 | identifier
'=' expr_no_commas
2827 { build_enumerator
($1, $3, current_enum_type
); }
2830 /* ISO new-type-id (5.3.4) */
2832 type_specifier_seq new_declarator
2833 { $$.t
= build_tree_list
($1.t
, $2);
2834 $$.new_type_flag
= $1.new_type_flag
; }
2835 | type_specifier_seq %prec EMPTY
2836 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
2837 $$.new_type_flag
= $1.new_type_flag
; }
2838 /* GNU extension to allow arrays of arbitrary types with
2839 non-constant dimension. */
2840 |
'(' type_id
')' '[' expr
']'
2843 pedwarn
("ISO C++ forbids array dimensions with parenthesized type in new");
2844 $$.t
= build_nt
(ARRAY_REF
, TREE_VALUE
($2.t
), $5);
2845 $$.t
= build_tree_list
(TREE_PURPOSE
($2.t
), $$.t
);
2846 $$.new_type_flag
= $2.new_type_flag
;
2851 /* empty */ %prec EMPTY
2853 | cv_qualifiers CV_QUALIFIER
2854 { $$
= tree_cons
(NULL_TREE
, $2, $$
); }
2857 nonempty_cv_qualifiers:
2859 { $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
2860 $$.new_type_flag
= 0; }
2861 | nonempty_cv_qualifiers CV_QUALIFIER
2862 { $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
2863 $$.new_type_flag
= $1.new_type_flag
; }
2864 | attributes %prec EMPTY
2865 { $$.t
= hash_tree_cons
($1, NULL_TREE
, NULL_TREE
);
2866 $$.new_type_flag
= 0; }
2867 | nonempty_cv_qualifiers attributes %prec EMPTY
2868 { $$.t
= hash_tree_cons
($2, NULL_TREE
, $1.t
);
2869 $$.new_type_flag
= $1.new_type_flag
; }
2872 /* These rules must follow the rules for function declarations
2873 and component declarations. That way, longer rules are preferred. */
2875 /* An expression which will not live on the momentary obstack. */
2877 '(' nonnull_exprlist
')'
2882 { $$
= empty_parms
(); }
2887 /* A declarator that is allowed only after an explicit typespec. */
2889 after_type_declarator_intern:
2890 after_type_declarator
2891 | attributes after_type_declarator
2893 /* Provide support for '(' attributes '*' declarator ')'
2895 $$
= tree_cons
($1, $2, NULL_TREE
);
2899 /* may all be followed by prec '.' */
2900 after_type_declarator:
2901 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2902 { $$
= make_pointer_declarator
($2.t
, $3); }
2903 |
'&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2904 { $$
= make_reference_declarator
($2.t
, $3); }
2905 |
'*' after_type_declarator_intern %prec UNARY
2906 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2907 |
'&' after_type_declarator_intern %prec UNARY
2908 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2909 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2910 { tree arg
= make_pointer_declarator
($2, $3);
2911 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2913 | direct_after_type_declarator
2916 direct_after_type_declarator:
2917 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
2918 { $$
= make_call_declarator
($$
, $2, $3, $4); }
2919 | direct_after_type_declarator
'[' expr
']'
2920 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
2921 | direct_after_type_declarator
'[' ']'
2922 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
2923 |
'(' after_type_declarator_intern
')'
2925 | nested_name_specifier type_name %prec EMPTY
2926 { push_nested_class
($1, 3);
2927 $$
= build_nt
(SCOPE_REF
, $$
, $2);
2928 TREE_COMPLEXITY
($$
) = current_class_depth
; }
2929 | type_name %prec EMPTY
2933 type_name %prec EMPTY
2935 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
2937 $$
= lookup_name
($1, 1);
2938 maybe_note_name_used_in_class
($1, $$
);
2943 | global_scope type_name
2945 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
2946 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
2949 got_scope
= NULL_TREE
;
2956 | global_scope nested_type
2961 nested_name_specifier type_name %prec EMPTY
2962 { $$
= get_type_decl
($2); }
2965 /* A declarator allowed whether or not there has been
2966 an explicit typespec. These cannot redeclare a typedef-name. */
2968 notype_declarator_intern:
2970 | attributes notype_declarator
2972 /* Provide support for '(' attributes '*' declarator ')'
2974 $$
= tree_cons
($1, $2, NULL_TREE
);
2979 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2980 { $$
= make_pointer_declarator
($2.t
, $3); }
2981 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2982 { $$
= make_reference_declarator
($2.t
, $3); }
2983 |
'*' notype_declarator_intern %prec UNARY
2984 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2985 |
'&' notype_declarator_intern %prec UNARY
2986 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2987 | ptr_to_mem cv_qualifiers notype_declarator_intern
2988 { tree arg
= make_pointer_declarator
($2, $3);
2989 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2991 | direct_notype_declarator
2994 complex_notype_declarator:
2995 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2996 { $$
= make_pointer_declarator
($2.t
, $3); }
2997 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2998 { $$
= make_reference_declarator
($2.t
, $3); }
2999 |
'*' complex_notype_declarator %prec UNARY
3000 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
3001 |
'&' complex_notype_declarator %prec UNARY
3002 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
3003 | ptr_to_mem cv_qualifiers notype_declarator_intern
3004 { tree arg
= make_pointer_declarator
($2, $3);
3005 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3007 | complex_direct_notype_declarator
3010 complex_direct_notype_declarator:
3011 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
3012 { $$
= make_call_declarator
($$
, $2, $3, $4); }
3013 |
'(' complex_notype_declarator
')'
3015 | direct_notype_declarator
'[' expr
']'
3016 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3017 | direct_notype_declarator
'[' ']'
3018 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
3019 | notype_qualified_id
3020 { enter_scope_of
($1); }
3021 | global_scope notype_qualified_id
3022 { enter_scope_of
($2); $$
= $2;}
3023 | global_scope notype_unqualified_id
3024 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $2);
3025 enter_scope_of
($$
);
3027 | nested_name_specifier notype_template_declarator
3028 { got_scope
= NULL_TREE
;
3029 $$
= build_nt
(SCOPE_REF
, $1, $2);
3030 enter_scope_of
($$
);
3035 nested_name_specifier unqualified_id
3036 { got_scope
= NULL_TREE
;
3037 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
3038 | nested_name_specifier object_template_id
3039 { got_scope
= NULL_TREE
;
3040 $$
= build_nt
(SCOPE_REF
, $1, $2); }
3043 notype_qualified_id:
3044 nested_name_specifier notype_unqualified_id
3045 { got_scope
= NULL_TREE
;
3046 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
3047 | nested_name_specifier object_template_id
3048 { got_scope
= NULL_TREE
;
3049 $$
= build_nt
(SCOPE_REF
, $1, $2); }
3054 | global_scope notype_qualified_id
3059 typespec
'(' nonnull_exprlist
')'
3060 { $$
= build_functional_cast
($1.t
, $3); }
3061 | typespec
'(' expr_or_declarator_intern
')'
3062 { $$
= reparse_decl_as_expr
($1.t
, $3); }
3063 | typespec fcast_or_absdcl %prec EMPTY
3064 { $$
= reparse_absdcl_as_expr
($1.t
, $2); }
3070 | template_type %prec EMPTY
3073 nested_name_specifier:
3074 nested_name_specifier_1
3075 | nested_name_specifier nested_name_specifier_1
3077 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
3079 = make_typename_type
($1, $3, tf_error
); }
3080 /* Error handling per Core 125. */
3081 | nested_name_specifier IDENTIFIER SCOPE
3083 = make_typename_type
($1, $2, tf_error
); }
3084 | nested_name_specifier PTYPENAME SCOPE
3086 = make_typename_type
($1, $2, tf_error
); }
3089 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3090 inline here?!? (jason) */
3091 nested_name_specifier_1:
3094 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3097 maybe_note_name_used_in_class
($1, $$
);
3100 complete_type
(TYPE_MAIN_VARIANT
(TREE_TYPE
($$
)));
3104 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3106 got_scope
= $$
= TREE_TYPE
($$
);
3110 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3114 | template_type SCOPE
3115 { got_scope
= $$
= complete_type
(TREE_TYPE
($1)); }
3120 | global_scope typename_sub0
3125 typename_sub1 identifier %prec EMPTY
3128 $$
= make_typename_type
($1, $2, tf_error
);
3129 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3130 error ("`%T' is not a class or namespace", $2);
3134 if
(TREE_CODE
($$
) == TYPE_DECL
)
3135 $$
= TREE_TYPE
($$
);
3138 | typename_sub1 template_type %prec EMPTY
3139 { $$
= TREE_TYPE
($2); }
3140 | typename_sub1 explicit_template_type %prec EMPTY
3141 { $$
= make_typename_type
($1, $2, tf_error
); }
3142 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
3143 { $$
= make_typename_type
($1, $3, tf_error
); }
3149 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3150 error ("`%T' is not a class or namespace", $1);
3151 else if
(TREE_CODE
($1) == TYPE_DECL
)
3152 $$
= TREE_TYPE
($1);
3154 | typename_sub1 typename_sub2
3157 $$
= make_typename_type
($1, $2, tf_error
);
3158 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3159 error ("`%T' is not a class or namespace", $2);
3163 if
(TREE_CODE
($$
) == TYPE_DECL
)
3164 $$
= TREE_TYPE
($$
);
3167 | typename_sub1 explicit_template_type SCOPE
3169 = make_typename_type
($1, $2, tf_error
); }
3170 | typename_sub1 TEMPLATE explicit_template_type SCOPE
3172 = make_typename_type
($1, $3, tf_error
); }
3175 /* This needs to return a TYPE_DECL for simple names so that we don't
3176 forget what name was used. */
3180 if
(TREE_CODE
($1) != TYPE_DECL
)
3183 /* Retrieve the type for the identifier, which might involve
3184 some computation. */
3185 got_scope
= complete_type
(TREE_TYPE
($$
));
3187 if
($$
== error_mark_node
)
3188 error ("`%T' is not a class or namespace", $1);
3192 if
(TREE_CODE
($1) != TYPE_DECL
)
3194 got_scope
= complete_type
(TREE_TYPE
($$
));
3196 | template_type SCOPE
3197 { got_scope
= $$
= complete_type
(TREE_TYPE
($$
)); }
3202 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3208 explicit_template_type:
3209 identifier
'<' template_arg_list_opt template_close_bracket
3210 { $$
= build_min_nt
(TEMPLATE_ID_EXPR
, $1, $3); }
3214 global_scope type_name
3216 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3217 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
3220 got_scope
= NULL_TREE
;
3223 | global_scope nested_type
3228 nested_name_specifier
'*'
3229 { got_scope
= NULL_TREE
; }
3230 | global_scope nested_name_specifier
'*'
3231 { $$
= $2; got_scope
= NULL_TREE
; }
3234 /* All uses of explicit global scope must go through this nonterminal so
3235 that got_scope will be set before yylex is called to get the next token. */
3238 { got_scope
= void_type_node
; }
3241 /* ISO new-declarator (5.3.4) */
3243 '*' cv_qualifiers new_declarator
3244 { $$
= make_pointer_declarator
($2, $3); }
3245 |
'*' cv_qualifiers %prec EMPTY
3246 { $$
= make_pointer_declarator
($2, NULL_TREE
); }
3247 |
'&' cv_qualifiers new_declarator %prec EMPTY
3248 { $$
= make_reference_declarator
($2, $3); }
3249 |
'&' cv_qualifiers %prec EMPTY
3250 { $$
= make_reference_declarator
($2, NULL_TREE
); }
3251 | ptr_to_mem cv_qualifiers %prec EMPTY
3252 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3253 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3255 | ptr_to_mem cv_qualifiers new_declarator
3256 { tree arg
= make_pointer_declarator
($2, $3);
3257 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3259 | direct_new_declarator %prec EMPTY
3262 /* ISO direct-new-declarator (5.3.4) */
3263 direct_new_declarator:
3265 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3266 | direct_new_declarator
'[' expr
']'
3267 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3274 /* Provide support for '(' attributes '*' declarator ')'
3276 $$
= tree_cons
($1, $2, NULL_TREE
);
3280 /* ISO abstract-declarator (8.1) */
3282 '*' nonempty_cv_qualifiers absdcl_intern
3283 { $$
= make_pointer_declarator
($2.t
, $3); }
3285 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
3286 |
'*' nonempty_cv_qualifiers %prec EMPTY
3287 { $$
= make_pointer_declarator
($2.t
, NULL_TREE
); }
3289 { $$
= make_pointer_declarator
(NULL_TREE
, NULL_TREE
); }
3290 |
'&' nonempty_cv_qualifiers absdcl_intern
3291 { $$
= make_reference_declarator
($2.t
, $3); }
3293 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
3294 |
'&' nonempty_cv_qualifiers %prec EMPTY
3295 { $$
= make_reference_declarator
($2.t
, NULL_TREE
); }
3297 { $$
= make_reference_declarator
(NULL_TREE
, NULL_TREE
); }
3298 | ptr_to_mem cv_qualifiers %prec EMPTY
3299 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3300 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3302 | ptr_to_mem cv_qualifiers absdcl_intern
3303 { tree arg
= make_pointer_declarator
($2, $3);
3304 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3306 | direct_abstract_declarator %prec EMPTY
3309 /* ISO direct-abstract-declarator (8.1) */
3310 direct_abstract_declarator:
3311 '(' absdcl_intern
')'
3313 /* `(typedef)1' is `int'. */
3314 | direct_abstract_declarator
'(' parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3315 { $$
= make_call_declarator
($$
, $3, $5, $6); }
3316 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec
'.'
3317 { $$
= make_call_declarator
($$
, empty_parms
(), $3, $4); }
3318 | direct_abstract_declarator
'[' expr
']' %prec
'.'
3319 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3320 | direct_abstract_declarator
'[' ']' %prec
'.'
3321 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
3322 |
'(' complex_parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3323 { $$
= make_call_declarator
(NULL_TREE
, $2, $4, $5); }
3324 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3325 { set_quals_and_spec
($$
, $2, $3); }
3326 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3327 { set_quals_and_spec
($$
, $2, $3); }
3328 |
'[' expr
']' %prec
'.'
3329 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3331 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, NULL_TREE
); }
3334 /* For C++, decls and stmts can be intermixed, so we don't need to
3335 have a special rule that won't start parsing the stmt section
3336 until we have a stmt that parses without errors. */
3349 /* Read zero or more forward-declarations for labels
3350 that nested functions can jump to. */
3355 pedwarn
("ISO C++ forbids label declarations"); }
3360 | label_decls label_decl
3364 LABEL identifiers_or_typenames
';'
3368 finish_label_decl
(TREE_VALUE
($2));
3369 $2 = TREE_CHAIN
($2);
3374 compstmt_or_stmtexpr:
3376 { $
<ttype
>$
= begin_compound_stmt
(0); }
3378 { STMT_LINENO
($
<ttype
>3) = $1;
3379 finish_compound_stmt
(0, $
<ttype
>3); }
3383 compstmt_or_stmtexpr
3384 { last_expr_type
= NULL_TREE
; }
3389 { $
<ttype
>$
= begin_if_stmt
();
3390 cond_stmt_keyword
= "if"; }
3392 { finish_if_stmt_cond
($3, $
<ttype
>2); }
3393 implicitly_scoped_stmt
3395 finish_then_clause
($
<ttype
>2); }
3398 implicitly_scoped_stmt:
3401 { $
<ttype
>$
= begin_compound_stmt
(0); }
3402 save_lineno simple_stmt
3403 { STMT_LINENO
($
<ttype
>1) = $2;
3404 if
($3) STMT_LINENO
($3) = $2;
3405 finish_compound_stmt
(0, $
<ttype
>1); }
3410 | save_lineno simple_stmt
3411 { if
($2) STMT_LINENO
($2) = $1; }
3419 { $$
= finish_expr_stmt
($1); }
3421 { begin_else_clause
(); }
3422 implicitly_scoped_stmt
3425 finish_else_clause
($1);
3428 | simple_if %prec IF
3430 finish_if_stmt
(); }
3433 $
<ttype
>$
= begin_while_stmt
();
3434 cond_stmt_keyword
= "while";
3437 { finish_while_stmt_cond
($3, $
<ttype
>2); }
3438 implicitly_scoped_stmt
3440 finish_while_stmt
($
<ttype
>2); }
3442 { $
<ttype
>$
= begin_do_stmt
(); }
3443 implicitly_scoped_stmt WHILE
3445 finish_do_body
($
<ttype
>2);
3446 cond_stmt_keyword
= "do";
3448 paren_expr_or_null
';'
3450 finish_do_stmt
($6, $
<ttype
>2); }
3452 { $
<ttype
>$
= begin_for_stmt
(); }
3453 '(' for.init.statement
3454 { finish_for_init_stmt
($
<ttype
>2); }
3456 { finish_for_cond
($6, $
<ttype
>2); }
3458 { finish_for_expr
($9, $
<ttype
>2); }
3459 implicitly_scoped_stmt
3461 finish_for_stmt
($
<ttype
>2); }
3463 { $
<ttype
>$
= begin_switch_stmt
(); }
3465 { finish_switch_cond
($4, $
<ttype
>2); }
3466 implicitly_scoped_stmt
3468 finish_switch_stmt
($
<ttype
>2); }
3469 | CASE expr_no_commas
':'
3470 { $
<ttype
>$
= finish_case_label
($2, NULL_TREE
); }
3473 | CASE expr_no_commas ELLIPSIS expr_no_commas
':'
3474 { $
<ttype
>$
= finish_case_label
($2, $4); }
3478 { $
<ttype
>$
= finish_case_label
(NULL_TREE
, NULL_TREE
); }
3482 { $$
= finish_break_stmt
(); }
3484 { $$
= finish_continue_stmt
(); }
3485 | RETURN_KEYWORD
';'
3486 { $$
= finish_return_stmt
(NULL_TREE
); }
3487 | RETURN_KEYWORD expr
';'
3488 { $$
= finish_return_stmt
($2); }
3489 | asm_keyword maybe_cv_qualifier
'(' STRING
')' ';'
3490 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, NULL_TREE
,
3492 ASM_INPUT_P
($$
) = 1; }
3493 /* This is the case with just output operands. */
3494 | asm_keyword maybe_cv_qualifier
'(' STRING
':' asm_operands
')' ';'
3495 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, NULL_TREE
); }
3496 /* This is the case with input operands as well. */
3497 | asm_keyword maybe_cv_qualifier
'(' STRING
':' asm_operands
':'
3498 asm_operands
')' ';'
3499 { $$
= finish_asm_stmt
($2, $4, $6, $8, NULL_TREE
); }
3500 | asm_keyword maybe_cv_qualifier
'(' STRING SCOPE asm_operands
')' ';'
3501 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, NULL_TREE
); }
3502 /* This is the case with clobbered registers as well. */
3503 | asm_keyword maybe_cv_qualifier
'(' STRING
':' asm_operands
':'
3504 asm_operands
':' asm_clobbers
')' ';'
3505 { $$
= finish_asm_stmt
($2, $4, $6, $8, $10); }
3506 | asm_keyword maybe_cv_qualifier
'(' STRING SCOPE asm_operands
':'
3507 asm_clobbers
')' ';'
3508 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, $8); }
3509 | asm_keyword maybe_cv_qualifier
'(' STRING
':' asm_operands SCOPE
3510 asm_clobbers
')' ';'
3511 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, $8); }
3515 pedwarn
("ISO C++ forbids computed gotos");
3516 $$
= finish_goto_stmt
($3);
3518 | GOTO identifier
';'
3519 { $$
= finish_goto_stmt
($2); }
3523 { error ("label must be followed by statement");
3533 | namespace_using_decl
3534 { do_local_using_decl
($1);
3542 { $
<ttype
>$
= begin_function_try_block
(); }
3544 { finish_function_try_block
($
<ttype
>2); }
3546 { finish_function_handler_sequence
($
<ttype
>2); }
3551 { $
<ttype
>$
= begin_try_block
(); }
3553 { finish_try_block
($
<ttype
>2); }
3555 { finish_handler_sequence
($
<ttype
>2); }
3560 | handler_seq handler
3562 { /* Generate a fake handler block to avoid later aborts. */
3563 tree fake_handler
= begin_handler
();
3564 finish_handler_parms
(NULL_TREE
, fake_handler
);
3565 finish_handler
(fake_handler
);
3566 $
<ttype
>$
= fake_handler
;
3568 error ("must have at least one catch per try block");
3574 { $
<ttype
>$
= begin_handler
(); }
3576 { finish_handler_parms
($3, $
<ttype
>2); }
3578 { finish_handler
($
<ttype
>2); }
3582 typed_typespecs %prec EMPTY
3583 | nonempty_cv_qualifiers %prec EMPTY
3589 /* This doesn't allow reference parameters, the below does.
3590 | '(' type_specifier_seq absdcl ')'
3591 { check_for_new_type ("inside exception declarations", $2);
3592 expand_start_catch_block ($2.t, $3); }
3593 | '(' type_specifier_seq ')'
3594 { check_for_new_type ("inside exception declarations", $2);
3595 expand_start_catch_block ($2.t, NULL_TREE); }
3596 | '(' type_specifier_seq notype_declarator ')'
3597 { check_for_new_type ("inside exception declarations", $2);
3598 expand_start_catch_block ($2.t, $3); }
3599 | '(' typed_typespecs after_type_declarator ')'
3600 { check_for_new_type ("inside exception declarations", $2);
3601 expand_start_catch_block ($2.t, $3); }
3602 This allows reference parameters... */
3605 check_for_new_type
("inside exception declarations", $2);
3606 $$
= start_handler_parms
(TREE_PURPOSE
($2.t
),
3613 { finish_label_stmt
($1); }
3615 { finish_label_stmt
($1); }
3617 { finish_label_stmt
($1); }
3619 { finish_label_stmt
($1); }
3624 { finish_expr_stmt
($1); }
3628 pedwarn
("ISO C++ forbids compound statements inside for initializations");
3632 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3648 /* These are the operands other than the first string and colon
3649 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3653 | nonnull_asm_operands
3656 nonnull_asm_operands:
3658 | nonnull_asm_operands
',' asm_operand
3659 { $$
= chainon
($$
, $3); }
3664 { $$
= build_tree_list
(build_tree_list
(NULL_TREE
, $1), $3); }
3665 |
'[' identifier
']' STRING
'(' expr
')'
3666 { $2 = build_string
(IDENTIFIER_LENGTH
($2),
3667 IDENTIFIER_POINTER
($2));
3668 $$
= build_tree_list
(build_tree_list
($2, $4), $6); }
3673 { $$
= tree_cons
(NULL_TREE
, $1, NULL_TREE
);}
3674 | asm_clobbers
',' STRING
3675 { $$
= tree_cons
(NULL_TREE
, $3, $1); }
3678 /* This is what appears inside the parens in a function declarator.
3679 Its value is represented in the format that grokdeclarator expects.
3681 In C++, declaring a function with no parameters
3682 means that that function takes *no* parameters. */
3691 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
, $1.t
), 0);
3692 check_for_new_type
("inside parameter list", $1); }
3695 /* This nonterminal does not include the common sequence '(' type_id ')',
3696 as it is ambiguous and must be disambiguated elsewhere. */
3699 { $$
= finish_parmlist
($$
, 0); }
3700 | parms_comma ELLIPSIS
3701 { $$
= finish_parmlist
($1, 1); }
3702 /* C++ allows an ellipsis without a separating ',' */
3704 { $$
= finish_parmlist
($1, 1); }
3706 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3709 { $$
= finish_parmlist
(NULL_TREE
, 1); }
3712 /* This helps us recover from really nasty
3713 parse errors, for example, a missing right
3715 yyerror ("possibly missing ')'");
3716 $$
= finish_parmlist
($1, 0);
3722 /* This helps us recover from really nasty
3723 parse errors, for example, a missing right
3725 yyerror ("possibly missing ')'");
3726 $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3733 /* A default argument to a */
3736 { maybe_snarf_defarg
(); }
3746 /* A nonempty list of parameter declarations or type names. */
3749 { check_for_new_type
("in a parameter list", $1);
3750 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3752 { check_for_new_type
("in a parameter list", $1);
3753 $$
= build_tree_list
($2, $1.t
); }
3754 | parms_comma full_parm
3755 { check_for_new_type
("in a parameter list", $2);
3756 $$
= chainon
($$
, $2.t
); }
3757 | parms_comma bad_parm
3758 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $2)); }
3759 | parms_comma bad_parm
'=' init
3760 { $$
= chainon
($$
, build_tree_list
($4, $2)); }
3766 { check_for_new_type
("in a parameter list", $1);
3767 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3770 /* A single parameter declaration or parameter type name,
3771 as found in a parmlist. */
3773 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3774 TYPESPEC IDENTIFIER. */
3775 typed_declspecs1 declarator
3776 { $$.new_type_flag
= $1.new_type_flag
;
3777 $$.t
= build_tree_list
($1.t
, $2); }
3778 | typed_typespecs declarator
3779 { $$.t
= build_tree_list
($1.t
, $2);
3780 $$.new_type_flag
= $1.new_type_flag
; }
3781 | typespec declarator
3782 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
3784 $$.new_type_flag
= $1.new_type_flag
; }
3785 | typed_declspecs1 absdcl
3786 { $$.t
= build_tree_list
($1.t
, $2);
3787 $$.new_type_flag
= $1.new_type_flag
; }
3788 | typed_declspecs1 %prec EMPTY
3789 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
3790 $$.new_type_flag
= $1.new_type_flag
; }
3791 | declmods notype_declarator
3792 { $$.t
= build_tree_list
($1.t
, $2);
3793 $$.new_type_flag
= 0; }
3798 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
3799 $$.new_type_flag
= $1.new_type_flag
; }
3801 { $$.t
= build_tree_list
($2, $1.t
);
3802 $$.new_type_flag
= $1.new_type_flag
; }
3811 /* empty */ %prec EMPTY
3812 { see_typename
(); }
3816 /* empty */ %prec EMPTY
3818 error ("type specifier omitted for parameter");
3819 $$
= build_tree_list
(integer_type_node
, NULL_TREE
);
3823 if
(TREE_CODE
($$
) == SCOPE_REF
)
3825 if
(TREE_CODE
(TREE_OPERAND
($$
, 0)) == TEMPLATE_TYPE_PARM
3826 || TREE_CODE
(TREE_OPERAND
($$
, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM
)
3827 error ("`%E' is not a type, use `typename %E' to make it one", $$
);
3829 error ("no type `%D' in `%T'", TREE_OPERAND
($$
, 1), TREE_OPERAND
($$
, 0));
3832 error ("type specifier omitted for parameter `%E'", $$
);
3833 $$
= build_tree_list
(integer_type_node
, $$
);
3838 IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore
';'
3840 error("'%D' is used as a type, but is not defined as a type.", $1);
3841 $3 = error_mark_node
;
3845 template_arg_list_ignore:
3846 '<' template_arg_list_opt template_close_bracket
3852 '(' nonnull_exprlist
')'
3857 exception_specification_opt:
3858 /* empty */ %prec EMPTY
3860 | THROW
'(' ansi_raise_identifiers
')' %prec EMPTY
3862 | THROW LEFT_RIGHT %prec EMPTY
3863 { $$
= empty_except_spec
; }
3866 ansi_raise_identifier:
3869 check_for_new_type
("exception specifier", $1);
3870 $$
= groktypename
($1.t
);
3873 { $$
= error_mark_node
; }
3876 ansi_raise_identifiers:
3877 ansi_raise_identifier
3878 { $$
= add_exception_specifier
(NULL_TREE
, $1, 1); }
3879 | ansi_raise_identifiers
',' ansi_raise_identifier
3880 { $$
= add_exception_specifier
($1, $3, 1); }
3883 conversion_declarator:
3884 /* empty */ %prec EMPTY
3886 |
'*' cv_qualifiers conversion_declarator
3887 { $$
= make_pointer_declarator
($2, $3); }
3888 |
'&' cv_qualifiers conversion_declarator
3889 { $$
= make_reference_declarator
($2, $3); }
3890 | ptr_to_mem cv_qualifiers conversion_declarator
3891 { tree arg
= make_pointer_declarator
($2, $3);
3892 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3899 saved_scopes
= tree_cons
(got_scope
, got_object
, saved_scopes
);
3900 TREE_LANG_FLAG_0
(saved_scopes
) = looking_for_typename
;
3901 /* We look for conversion-type-id's in both the class and current
3902 scopes, just as for ID in 'ptr->ID::'. */
3903 looking_for_typename
= 1;
3904 got_object
= got_scope
;
3905 got_scope
= NULL_TREE
;
3910 { got_scope
= TREE_PURPOSE
(saved_scopes
);
3911 got_object
= TREE_VALUE
(saved_scopes
);
3912 looking_for_typename
= TREE_LANG_FLAG_0
(saved_scopes
);
3913 saved_scopes
= TREE_CHAIN
(saved_scopes
);
3918 operator
'*' unoperator
3919 { $$
= frob_opname
(ansi_opname
(MULT_EXPR
)); }
3920 | operator
'/' unoperator
3921 { $$
= frob_opname
(ansi_opname
(TRUNC_DIV_EXPR
)); }
3922 | operator
'%' unoperator
3923 { $$
= frob_opname
(ansi_opname
(TRUNC_MOD_EXPR
)); }
3924 | operator
'+' unoperator
3925 { $$
= frob_opname
(ansi_opname
(PLUS_EXPR
)); }
3926 | operator
'-' unoperator
3927 { $$
= frob_opname
(ansi_opname
(MINUS_EXPR
)); }
3928 | operator
'&' unoperator
3929 { $$
= frob_opname
(ansi_opname
(BIT_AND_EXPR
)); }
3930 | operator
'|' unoperator
3931 { $$
= frob_opname
(ansi_opname
(BIT_IOR_EXPR
)); }
3932 | operator
'^' unoperator
3933 { $$
= frob_opname
(ansi_opname
(BIT_XOR_EXPR
)); }
3934 | operator
'~' unoperator
3935 { $$
= frob_opname
(ansi_opname
(BIT_NOT_EXPR
)); }
3936 | operator
',' unoperator
3937 { $$
= frob_opname
(ansi_opname
(COMPOUND_EXPR
)); }
3938 | operator ARITHCOMPARE unoperator
3939 { $$
= frob_opname
(ansi_opname
($2)); }
3940 | operator
'<' unoperator
3941 { $$
= frob_opname
(ansi_opname
(LT_EXPR
)); }
3942 | operator
'>' unoperator
3943 { $$
= frob_opname
(ansi_opname
(GT_EXPR
)); }
3944 | operator EQCOMPARE unoperator
3945 { $$
= frob_opname
(ansi_opname
($2)); }
3946 | operator ASSIGN unoperator
3947 { $$
= frob_opname
(ansi_assopname
($2)); }
3948 | operator
'=' unoperator
3949 { $$
= frob_opname
(ansi_assopname
(NOP_EXPR
)); }
3950 | operator LSHIFT unoperator
3951 { $$
= frob_opname
(ansi_opname
($2)); }
3952 | operator RSHIFT unoperator
3953 { $$
= frob_opname
(ansi_opname
($2)); }
3954 | operator PLUSPLUS unoperator
3955 { $$
= frob_opname
(ansi_opname
(POSTINCREMENT_EXPR
)); }
3956 | operator MINUSMINUS unoperator
3957 { $$
= frob_opname
(ansi_opname
(PREDECREMENT_EXPR
)); }
3958 | operator ANDAND unoperator
3959 { $$
= frob_opname
(ansi_opname
(TRUTH_ANDIF_EXPR
)); }
3960 | operator OROR unoperator
3961 { $$
= frob_opname
(ansi_opname
(TRUTH_ORIF_EXPR
)); }
3962 | operator
'!' unoperator
3963 { $$
= frob_opname
(ansi_opname
(TRUTH_NOT_EXPR
)); }
3964 | operator
'?' ':' unoperator
3965 { $$
= frob_opname
(ansi_opname
(COND_EXPR
)); }
3966 | operator MIN_MAX unoperator
3967 { $$
= frob_opname
(ansi_opname
($2)); }
3968 | operator POINTSAT unoperator %prec EMPTY
3969 { $$
= frob_opname
(ansi_opname
(COMPONENT_REF
)); }
3970 | operator POINTSAT_STAR unoperator %prec EMPTY
3971 { $$
= frob_opname
(ansi_opname
(MEMBER_REF
)); }
3972 | operator LEFT_RIGHT unoperator
3973 { $$
= frob_opname
(ansi_opname
(CALL_EXPR
)); }
3974 | operator
'[' ']' unoperator
3975 { $$
= frob_opname
(ansi_opname
(ARRAY_REF
)); }
3976 | operator NEW unoperator %prec EMPTY
3977 { $$
= frob_opname
(ansi_opname
(NEW_EXPR
)); }
3978 | operator DELETE unoperator %prec EMPTY
3979 { $$
= frob_opname
(ansi_opname
(DELETE_EXPR
)); }
3980 | operator NEW
'[' ']' unoperator
3981 { $$
= frob_opname
(ansi_opname
(VEC_NEW_EXPR
)); }
3982 | operator DELETE
'[' ']' unoperator
3983 { $$
= frob_opname
(ansi_opname
(VEC_DELETE_EXPR
)); }
3984 | operator type_specifier_seq conversion_declarator unoperator
3985 { $$
= frob_opname
(grokoptypename
($2.t
, $3)); }
3986 | operator
error unoperator
3987 { $$
= frob_opname
(ansi_opname
(ERROR_MARK
)); }
3990 /* The forced readahead in here is because we might be at the end of a
3991 line, and lineno won't be bumped until yylex absorbs the first token
3992 on the next line. */
3994 { if
(yychar == YYEMPTY
)
4002 debug_yytranslate
(value
)
4005 return yytname
[YYTRANSLATE
(value
)];
4009 /* Free malloced parser stacks if necessary. */
4012 free_parser_stacks
()
4016 free
(malloced_yyss
);
4017 free
(malloced_yyvs
);
4021 /* Return the value corresponding to TOKEN in the global scope. */
4024 parse_scoped_id
(token
)
4029 id
= make_node
(CPLUS_BINDING
);
4030 if
(!qualified_lookup_using_namespace
(token
, global_namespace
, id
, 0))
4033 id
= BINDING_VALUE
(id
);
4034 if
(yychar == YYEMPTY
)
4037 return do_scoped_id
(token
, id
);
4040 #include "gt-cp-parse.h"