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. */
31 /* Cause the `yydebug' variable to be defined. */
48 extern
struct obstack permanent_obstack
;
50 /* Like YYERROR but do call yyerror. */
51 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
53 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
54 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
56 /* Contains the statement keyword (if/while/do) to include in an
57 error message if the user supplies an empty conditional expression. */
58 static const char *cond_stmt_keyword
;
60 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
64 /* List of types and structure classes of the current declaration. */
65 static tree current_declspecs
;
67 /* List of prefix attributes in effect.
68 Prefix attributes are parsed by the reserved_declspecs and declmods
69 rules. They create a list that contains *both* declspecs and attrs. */
70 /* ??? It is not clear yet that all cases where an attribute can now appear in
71 a declspec list have been updated. */
72 static tree prefix_attributes
;
74 /* When defining an enumeration, this is the type of the enumeration. */
75 static tree current_enum_type
;
77 /* When parsing a conversion operator name, this is the scope of the
79 static tree saved_scopes
;
81 static tree empty_parms PARAMS
((void));
82 static tree parse_decl0 PARAMS
((tree
, tree
, tree
, tree
, int));
83 static tree parse_decl PARAMS
((tree
, tree
, int));
84 static void parse_end_decl PARAMS
((tree
, tree
, tree
));
85 static tree parse_field0 PARAMS
((tree
, tree
, tree
, tree
, tree
, tree
));
86 static tree parse_field PARAMS
((tree
, tree
, tree
, tree
));
87 static tree parse_bitfield0 PARAMS
((tree
, tree
, tree
, tree
, tree
));
88 static tree parse_bitfield PARAMS
((tree
, tree
, tree
));
89 static tree parse_method PARAMS
((tree
, tree
, tree
));
90 static void frob_specs PARAMS
((tree
, tree
));
91 static void check_class_key PARAMS
((tree
, tree
));
93 /* Cons up an empty parameter list. */
99 #ifndef NO_IMPLICIT_EXTERN_C
100 if
(in_system_header
&& current_class_type
== NULL
101 && current_lang_name
== lang_name_c
)
105 parms
= void_list_node
;
109 /* Record the decl-specifiers, attributes and type lookups from the
110 decl-specifier-seq in a declaration. */
113 frob_specs
(specs_attrs
, lookups
)
114 tree specs_attrs
, lookups
;
116 save_type_access_control
(lookups
);
117 split_specs_attrs
(specs_attrs
, ¤t_declspecs
, &prefix_attributes
);
118 if
(current_declspecs
119 && TREE_CODE
(current_declspecs
) != TREE_LIST
)
120 current_declspecs
= build_tree_list
(NULL_TREE
, current_declspecs
);
121 if
(have_extern_spec
&& !used_extern_spec
)
123 /* We have to indicate that there is an "extern", but that it
124 was part of a language specifier. For instance,
126 extern "C" typedef int (*Ptr) ();
129 current_declspecs
= tree_cons
(error_mark_node
,
130 get_identifier
("extern"),
132 used_extern_spec
= 1;
137 parse_decl
(declarator
, attributes
, initialized
)
138 tree declarator
, attributes
;
141 return start_decl
(declarator
, current_declspecs
, initialized
,
142 attributes
, prefix_attributes
);
146 parse_decl0
(declarator
, specs_attrs
, lookups
, attributes
, initialized
)
147 tree declarator
, specs_attrs
, lookups
, attributes
;
150 frob_specs
(specs_attrs
, lookups
);
151 return parse_decl
(declarator
, attributes
, initialized
);
155 parse_end_decl
(decl
, init
, asmspec
)
156 tree decl
, init
, asmspec
;
158 /* If decl is NULL_TREE, then this was a variable declaration using
159 () syntax for the initializer, so we handled it in grokdeclarator. */
161 decl_type_access_control
(decl
);
162 cp_finish_decl
(decl
, init
, asmspec
, init ? LOOKUP_ONLYCONVERTING
: 0);
166 parse_field
(declarator
, attributes
, asmspec
, init
)
167 tree declarator
, attributes
, asmspec
, init
;
169 tree d
= grokfield
(declarator
, current_declspecs
, init
, asmspec
,
170 chainon
(attributes
, prefix_attributes
));
171 decl_type_access_control
(d
);
176 parse_field0
(declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
)
177 tree declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
;
179 frob_specs
(specs_attrs
, lookups
);
180 return parse_field
(declarator
, attributes
, asmspec
, init
);
184 parse_bitfield
(declarator
, attributes
, width
)
185 tree declarator
, attributes
, width
;
187 tree d
= grokbitfield
(declarator
, current_declspecs
, width
);
188 cplus_decl_attributes
(&d
, chainon
(attributes
, prefix_attributes
), 0);
189 decl_type_access_control
(d
);
194 parse_bitfield0
(declarator
, specs_attrs
, lookups
, attributes
, width
)
195 tree declarator
, specs_attrs
, lookups
, attributes
, width
;
197 frob_specs
(specs_attrs
, lookups
);
198 return parse_bitfield
(declarator
, attributes
, width
);
202 parse_method
(declarator
, specs_attrs
, lookups
)
203 tree declarator
, specs_attrs
, lookups
;
206 frob_specs
(specs_attrs
, lookups
);
207 d
= start_method
(current_declspecs
, declarator
, prefix_attributes
);
208 decl_type_access_control
(d
);
213 check_class_key
(key
, aggr
)
217 if
(TREE_CODE
(key
) == TREE_LIST
)
218 key
= TREE_VALUE
(key
);
219 if
((key
== union_type_node
) != (TREE_CODE
(aggr
) == UNION_TYPE
))
220 pedwarn
("`%s' tag used in naming `%#T'",
221 key
== union_type_node ?
"union"
222 : key
== record_type_node ?
"struct" : "class", aggr
);
228 ggc_add_tree_root
(¤t_declspecs
, 1);
229 ggc_add_tree_root
(&prefix_attributes
, 1);
230 ggc_add_tree_root
(¤t_enum_type
, 1);
231 ggc_add_tree_root
(&saved_scopes
, 1);
234 /* Rename the "yyparse" function so that we can override it elsewhere. */
235 #define yyparse yyparse_1
245 flagged_type_tree ftype
;
246 struct unparsed_text
*pi
;
249 /* All identifiers that are not reserved words
250 and are not declared typedefs in the current block */
253 /* All identifiers that are declared typedefs in the current block.
254 In some contexts, they are treated just like IDENTIFIER,
255 but they can also serve as typespecs in declarations. */
259 /* A template function. */
262 /* Reserved words that specify storage class.
263 yylval contains an IDENTIFIER_NODE which indicates which one. */
266 /* Reserved words that specify type.
267 yylval contains an IDENTIFIER_NODE which indicates which one. */
270 /* Reserved words that qualify type: "const" or "volatile".
271 yylval contains an IDENTIFIER_NODE which indicates which one. */
274 /* Character or numeric constants.
275 yylval is the node for the constant. */
278 /* __func__, __FUNCTION__ or __PRETTY_FUNCTION__.
279 yylval contains an IDENTIFIER_NODE which indicates which one. */
282 /* String constants in raw form.
283 yylval is a STRING_CST node. */
286 /* "...", used for functions with variable arglists. */
289 /* the reserved words */
290 /* SCO include files test "ASM", so use something else. */
291 %token SIZEOF ENUM
/* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
292 %token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
294 %token ATTRIBUTE EXTENSION LABEL
295 %token REALPART IMAGPART VA_ARG
297 /* the reserved words... C++ extensions */
299 %token
<ttype
> VISSPEC
300 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
301 %token NAMESPACE TYPENAME_KEYWORD USING
302 %token LEFT_RIGHT TEMPLATE
303 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
306 /* Define the operator tokens and their precedences.
307 The value is an integer because, if used, it is the tree code
308 to use in the expression made from the operator. */
310 %left EMPTY
/* used to resolve s/r with epsilon */
314 /* Add precedence rules to solve dangling else s/r conflict */
318 %left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD ATTRIBUTE
324 %right
<code
> ASSIGN
'='
332 %left
<code
> EQCOMPARE
333 %left
<code
> ARITHCOMPARE
'<' '>'
334 %left
<code
> LSHIFT RSHIFT
336 %left
<code
> '*' '/' '%'
337 %left
<code
> POINTSAT_STAR DOT_STAR
338 %right
<code
> UNARY PLUSPLUS MINUSMINUS
'~'
340 %left
<ttype
> LEFT_RIGHT
341 %left
<code
> POINTSAT
'.' '(' '['
343 %right SCOPE
/* C++ extension */
344 %nonassoc NEW DELETE TRY CATCH
348 %type
<ttype
> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
349 %type
<ttype
> PFUNCNAME maybe_identifier
350 %type
<ttype
> paren_expr_or_null nontrivial_exprlist SELFNAME
351 %type
<ttype
> expr_no_commas expr_no_comma_rangle
352 %type
<ttype
> cast_expr unary_expr primary
string STRING
353 %type
<ttype
> reserved_declspecs boolean.literal
354 %type
<ttype
> reserved_typespecquals
355 %type
<ttype
> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
356 %type
<ttype
> init initlist maybeasm maybe_init defarg defarg1
357 %type
<ttype
> asm_operands nonnull_asm_operands asm_operand asm_clobbers
358 %type
<ttype
> maybe_attribute attributes attribute attribute_list attrib
359 %type
<ttype
> any_word
361 %type
<itype
> save_lineno
362 %type
<ttype
> simple_stmt simple_if
364 %type
<ttype
> declarator notype_declarator after_type_declarator
365 %type
<ttype
> notype_declarator_intern absdcl_intern
366 %type
<ttype
> after_type_declarator_intern
367 %type
<ttype
> direct_notype_declarator direct_after_type_declarator
368 %type
<itype
> components notype_components
369 %type
<ttype
> component_decl component_decl_1
370 %type
<ttype
> component_declarator component_declarator0
371 %type
<ttype
> notype_component_declarator notype_component_declarator0
372 %type
<ttype
> after_type_component_declarator after_type_component_declarator0
373 %type
<ttype
> absdcl cv_qualifiers
374 %type
<ttype
> direct_abstract_declarator conversion_declarator
375 %type
<ttype
> new_declarator direct_new_declarator
376 %type
<ttype
> xexpr parmlist parms bad_parm
377 %type
<ttype
> identifiers_or_typenames
378 %type
<ttype
> fcast_or_absdcl regcast_or_absdcl
379 %type
<ttype
> expr_or_declarator expr_or_declarator_intern
380 %type
<ttype
> complex_notype_declarator
381 %type
<ttype
> notype_unqualified_id unqualified_id qualified_id
382 %type
<ttype
> template_id do_id object_template_id notype_template_declarator
383 %type
<ttype
> overqualified_id notype_qualified_id any_id
384 %type
<ttype
> complex_direct_notype_declarator functional_cast
385 %type
<ttype
> complex_parmlist parms_comma
386 %type
<ttype
> namespace_qualifier namespace_using_decl
388 %type
<ftype
> type_id new_type_id typed_typespecs typespec typed_declspecs
389 %type
<ftype
> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
390 %type
<ftype
> structsp typespecqual_reserved parm named_parm full_parm
391 %type
<ftype
> declmods
393 %type
<itype
> extension
396 %token
<ttype
> PTYPENAME
397 %token
<ttype
> EXTERN_LANG_STRING ALL
398 %token
<ttype
> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
399 %token
<pi
> PRE_PARSED_FUNCTION_DECL
400 %type
<ttype
> component_constructor_declarator
401 %type
<ttype
> fn.def2 return_id constructor_declarator
402 %type
<ttype
> .begin_function_body
403 %type
<ttype
> class_head class_head_apparent_template
404 %type
<ftype
> class_head_decl class_head_defn
405 %type
<ttype
> base_class_list
406 %type
<ttype
> base_class_access_list
407 %type
<ttype
> base_class maybe_base_class_list base_class
.1
408 %type
<ttype
> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
409 %type
<ttype
> operator_name
410 %type
<ttype
> object aggr
411 %type
<itype
> new delete
412 /* %type <ttype> primary_no_id */
413 %type
<ttype
> maybe_parmlist
414 %type
<ttype
> member_init
415 %type
<ftype
> member_init_list
416 %type
<ttype
> template_parm_header template_spec_header template_header
417 %type
<ttype
> template_parm_list template_parm
418 %type
<ttype
> template_type_parm template_template_parm
419 %type
<code
> template_close_bracket
420 %type
<ttype
> apparent_template_type
421 %type
<ttype
> template_type template_arg_list template_arg_list_opt
422 %type
<ttype
> template_arg
423 %type
<ttype
> condition xcond paren_cond_or_null
424 %type
<ttype
> type_name nested_name_specifier nested_type ptr_to_mem
425 %type
<ttype
> complete_type_name notype_identifier nonnested_type
426 %type
<ttype
> complex_type_name nested_name_specifier_1
427 %type
<ttype
> new_initializer new_placement
428 %type
<ttype
> using_decl
429 %type
<ttype
> typename_sub typename_sub0 typename_sub1 typename_sub2
430 %type
<ttype
> explicit_template_type
431 /* in order to recognize aggr tags as defining and thus shadowing. */
432 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
433 %type
<ttype
> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
434 %type
<ttype
> handler_args
435 %type
<ttype
> self_template_type .finish_template_type
440 /* Used in lex.c for parsing pragmas. */
443 /* lex.c and pt.c depend on this being the last token. Define
444 any new tokens before this one! */
445 %token END_OF_SAVED_INPUT
448 /* Tell yyparse how to print a token's value, if yydebug is set. */
449 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
450 extern
void yyprint PARAMS
((FILE *, int, YYSTYPE));
456 { finish_translation_unit
(); }
458 { finish_translation_unit
(); }
461 /* the reason for the strange actions in this rule
462 is so that notype_initdecls when reached via datadef
463 can find a valid list of type and sc specs in $0. */
466 { $
<ttype
>$
= NULL_TREE
; }
468 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
469 | extdefs lang_extdef
470 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
479 { have_extern_spec
= 1;
480 used_extern_spec
= 0;
481 $
<ttype
>$
= NULL_TREE
; }
484 { have_extern_spec
= 0; }
498 { if
(pending_lang_change
) do_pending_lang_change
();
499 type_lookups
= NULL_TREE
; }
501 { if
(! toplevel_bindings_p
())
506 fndef eat_saved_input
507 { do_pending_inlines
(); }
509 { do_pending_inlines
(); }
512 { warning
("keyword `export' not implemented, and will be ignored"); }
514 { do_pending_inlines
(); }
516 { do_pending_inlines
(); }
517 | asm_keyword
'(' string ')' ';'
518 { if
(TREE_CHAIN
($3)) $3 = combine_strings
($3);
520 | extern_lang_string
'{' extdefs_opt
'}'
521 { pop_lang_context
(); }
522 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
523 { do_pending_inlines
(); pop_lang_context
(); }
524 | extern_lang_string .hush_warning datadef .warning_ok
525 { do_pending_inlines
(); pop_lang_context
(); }
526 | NAMESPACE identifier
'{'
527 { push_namespace
($2); }
529 { pop_namespace
(); }
531 { push_namespace
(NULL_TREE
); }
533 { pop_namespace
(); }
536 { do_toplevel_using_decl
($1); }
543 NAMESPACE identifier
'='
544 { begin_only_namespace_names
(); }
547 end_only_namespace_names
();
550 do_namespace_alias
($2, $5);
557 | USING global_scope qualified_id
559 | USING global_scope unqualified_id
563 namespace_using_decl:
564 USING namespace_qualifier identifier
565 { $$
= build_nt
(SCOPE_REF
, $2, $3); }
566 | USING global_scope identifier
567 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $3); }
568 | USING global_scope namespace_qualifier identifier
569 { $$
= build_nt
(SCOPE_REF
, $3, $4); }
574 { begin_only_namespace_names
(); }
577 end_only_namespace_names
();
578 /* If no declaration was found, the using-directive is
579 invalid. Since that was not reported, we need the
580 identifier for the error message. */
581 if
(TREE_CODE
($4) == IDENTIFIER_NODE
&& lastiddecl
)
583 do_using_directive
($4);
590 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
594 | namespace_qualifier NSNAME SCOPE
597 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
606 | global_scope qualified_id
608 | global_scope unqualified_id
614 { push_lang_context
($1); }
615 | extern_lang_string EXTERN_LANG_STRING
616 { if
(current_lang_name
!= $2)
617 error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name
);
618 pop_lang_context
(); push_lang_context
($2); }
621 template_parm_header:
623 { begin_template_parm_list
(); }
624 template_parm_list
'>'
625 { $$
= end_template_parm_list
($4); }
628 template_spec_header:
630 { begin_specialization
();
636 | template_spec_header
641 { $$
= process_template_parm
(NULL_TREE
, $1); }
642 | template_parm_list
',' template_parm
643 { $$
= process_template_parm
($1, $3); }
654 aggr maybe_identifier
655 { $$
= finish_template_type_parm
($1, $2); }
656 | TYPENAME_KEYWORD maybe_identifier
657 { $$
= finish_template_type_parm
(class_type_node
, $2); }
660 template_template_parm:
661 template_parm_header aggr maybe_identifier
662 { $$
= finish_template_template_parm
($2, $3); }
666 /* The following rules introduce a new reduce/reduce
667 conflict on the ',' and '>' input tokens: they are valid
668 prefixes for a `structsp', which means they could match a
669 nameless parameter. See 14.6, paragraph 3.
670 By putting them before the `parm' rule, we get
671 their match before considering them nameless parameter
674 { $$
= build_tree_list
(NULL_TREE
, $1); }
675 | template_type_parm
'=' type_id
676 { $$
= build_tree_list
(groktypename
($3.t
), $1); }
678 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
679 | parm
'=' expr_no_comma_rangle
680 { $$
= build_tree_list
($3, $1.t
); }
681 | template_template_parm
682 { $$
= build_tree_list
(NULL_TREE
, $1); }
683 | template_template_parm
'=' template_arg
685 if
(TREE_CODE
($3) != TEMPLATE_DECL
686 && TREE_CODE
($3) != TEMPLATE_TEMPLATE_PARM
687 && TREE_CODE
($3) != TYPE_DECL
688 && TREE_CODE
($3) != UNBOUND_CLASS_TEMPLATE
)
690 error ("invalid default template argument");
691 $3 = error_mark_node
;
693 $$
= build_tree_list
($3, $1);
698 template_header template_extdef
699 { finish_template_decl
($1); }
700 | template_header
error %prec EMPTY
701 { finish_template_decl
($1); }
705 fndef eat_saved_input
706 { do_pending_inlines
(); }
708 { do_pending_inlines
(); }
710 { do_pending_inlines
(); }
711 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
712 { do_pending_inlines
();
713 pop_lang_context
(); }
714 | extern_lang_string .hush_warning template_datadef .warning_ok
715 { do_pending_inlines
();
716 pop_lang_context
(); }
717 | extension template_extdef
723 | declmods notype_initdecls
';'
725 | typed_declspecs initdecls
';'
726 { note_list_got_semicolon
($1.t
); }
729 if
($1.t
!= error_mark_node
)
731 maybe_process_partial_specialization
($1.t
);
732 note_got_semicolon
($1.t
);
739 | declmods notype_initdecls
';'
741 | typed_declspecs initdecls
';'
742 { note_list_got_semicolon
($1.t
); }
744 { pedwarn
("empty declaration"); }
745 | explicit_instantiation
';'
746 | typed_declspecs
';'
749 split_specs_attrs
($1.t
, &t
, &attrs
);
751 note_list_got_semicolon
($1.t
);
755 |
error END_OF_SAVED_INPUT
761 ctor_initializer_opt:
777 /* The outermost block of a function really begins before the
778 mem-initializer-list, so we open one there and suppress the one that
779 actually corresponds to the curly braces. */
781 .begin_function_body ctor_initializer_opt save_lineno
'{'
782 { $
<ttype
>$
= begin_compound_stmt
(/*has_no_scope=*/1); }
785 STMT_LINENO
($
<ttype
>5) = $3;
786 finish_compound_stmt
(/*has_no_scope=*/1, $
<ttype
>5);
787 finish_function_body
($1);
792 fn.def1 maybe_return_init function_body
793 { expand_body
(finish_function
(0)); }
794 | fn.def1 maybe_return_init function_try_block
795 { expand_body
(finish_function
(0)); }
796 | fn.def1 maybe_return_init
error
800 constructor_declarator:
801 nested_name_specifier SELFNAME
'('
802 { $$
= begin_constructor_declarator
($1, $2); }
803 parmlist
')' cv_qualifiers exception_specification_opt
804 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
805 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
806 { $$
= begin_constructor_declarator
($1, $2);
807 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
809 | global_scope nested_name_specifier SELFNAME
'('
810 { $$
= begin_constructor_declarator
($2, $3); }
811 parmlist
')' cv_qualifiers exception_specification_opt
812 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
813 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
814 { $$
= begin_constructor_declarator
($2, $3);
815 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
817 | nested_name_specifier self_template_type
'('
818 { $$
= begin_constructor_declarator
($1, $2); }
819 parmlist
')' cv_qualifiers exception_specification_opt
820 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
821 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
822 { $$
= begin_constructor_declarator
($1, $2);
823 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
825 | global_scope nested_name_specifier self_template_type
'('
826 { $$
= begin_constructor_declarator
($2, $3); }
827 parmlist
')' cv_qualifiers exception_specification_opt
828 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
829 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
830 { $$
= begin_constructor_declarator
($2, $3);
831 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
836 typed_declspecs declarator
837 { check_for_new_type
("return type", $1);
838 if
(!begin_function_definition
($1.t
, $2))
840 | declmods notype_declarator
841 { if
(!begin_function_definition
($1.t
, $2))
844 { if
(!begin_function_definition
(NULL_TREE
, $1))
846 | declmods constructor_declarator
847 { if
(!begin_function_definition
($1.t
, $2))
849 | constructor_declarator
850 { if
(!begin_function_definition
(NULL_TREE
, $1))
854 /* ANSI allows optional parentheses around constructor class names.
855 See ISO/IEC 14882:1998(E) 12.1. */
857 component_constructor_declarator:
858 SELFNAME
'(' parmlist
')' cv_qualifiers exception_specification_opt
859 { $$
= make_call_declarator
($1, $3, $5, $6); }
860 |
'(' SELFNAME
')' '(' parmlist
')' cv_qualifiers
861 exception_specification_opt
862 { $$
= make_call_declarator
($2, $5, $7, $8); }
863 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
864 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
865 |
'(' SELFNAME
')' LEFT_RIGHT cv_qualifiers exception_specification_opt
866 { $$
= make_call_declarator
($2, empty_parms
(), $5, $6); }
867 | self_template_type
'(' parmlist
')' cv_qualifiers exception_specification_opt
868 { $$
= make_call_declarator
($1, $3, $5, $6); }
869 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
870 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
873 /* more C++ complexity. See component_decl for a comment on the
874 reduce/reduce conflict introduced by these rules. */
876 declmods component_constructor_declarator
877 { $$
= parse_method
($2, $1.t
, $1.lookups
);
881 if
(yychar == YYEMPTY
)
884 | component_constructor_declarator
885 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
887 | typed_declspecs declarator
888 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
889 | declmods notype_declarator
890 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
892 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
894 | declmods constructor_declarator
895 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
896 | constructor_declarator
897 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
902 RETURN_KEYWORD IDENTIFIER
910 { finish_named_return_value
($
<ttype
>$
, $2); }
911 | return_id
'(' nonnull_exprlist
')'
912 { finish_named_return_value
($
<ttype
>$
, $3); }
913 | return_id LEFT_RIGHT
914 { finish_named_return_value
($
<ttype
>$
, NULL_TREE
); }
920 if
(! DECL_CONSTRUCTOR_P
(current_function_decl
))
921 error ("only constructors take base initializers");
922 else if
($2.new_type_flag
== 0)
923 error ("no base or member initializers given following ':'");
925 finish_mem_initializers
($2.t
);
929 .begin_function_body
:
932 $$
= begin_function_body
();
939 $$.new_type_flag
= 0;
944 $$.new_type_flag
= 1;
947 | member_init_list
',' member_init
951 $$.new_type_flag
= 1;
952 TREE_CHAIN
($3) = $1.t
;
958 | member_init_list
error
962 '(' nonnull_exprlist
')'
964 if
(current_class_name
)
965 pedwarn
("anachronistic old style base class initializer");
966 $$
= expand_member_init
(current_class_ref
, NULL_TREE
, $2);
970 if
(current_class_name
)
971 pedwarn
("anachronistic old style base class initializer");
972 $$
= expand_member_init
(current_class_ref
,
976 | notype_identifier
'(' nonnull_exprlist
')'
977 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
978 | notype_identifier LEFT_RIGHT
979 { $$
= expand_member_init
(current_class_ref
, $1,
981 | nonnested_type
'(' nonnull_exprlist
')'
982 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
983 | nonnested_type LEFT_RIGHT
984 { $$
= expand_member_init
(current_class_ref
, $1,
986 | typename_sub
'(' nonnull_exprlist
')'
987 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
988 | typename_sub LEFT_RIGHT
989 { $$
= expand_member_init
(current_class_ref
, $1,
1006 | NSNAME %prec EMPTY
1015 explicit_instantiation:
1016 TEMPLATE begin_explicit_instantiation typespec
';'
1017 { do_type_instantiation
($3.t
, NULL_TREE
, 1);
1018 yyungetc
(';', 1); }
1019 end_explicit_instantiation
1020 | TEMPLATE begin_explicit_instantiation typed_declspecs declarator
1021 { tree specs
= strip_attrs
($3.t
);
1022 do_decl_instantiation
(specs
, $4, NULL_TREE
); }
1023 end_explicit_instantiation
1024 | TEMPLATE begin_explicit_instantiation notype_declarator
1025 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
1026 end_explicit_instantiation
1027 | TEMPLATE begin_explicit_instantiation constructor_declarator
1028 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
1029 end_explicit_instantiation
1030 | SCSPEC TEMPLATE begin_explicit_instantiation typespec
';'
1031 { do_type_instantiation
($4.t
, $1, 1);
1032 yyungetc
(';', 1); }
1033 end_explicit_instantiation
1034 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
1036 { tree specs
= strip_attrs
($4.t
);
1037 do_decl_instantiation
(specs
, $5, $1); }
1038 end_explicit_instantiation
1039 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
1040 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1041 end_explicit_instantiation
1042 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
1043 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1044 end_explicit_instantiation
1047 begin_explicit_instantiation:
1048 { begin_explicit_instantiation
(); }
1051 end_explicit_instantiation:
1052 { end_explicit_instantiation
(); }
1055 /* The TYPENAME expansions are to deal with use of a template class name as
1056 a template within the class itself, where the template decl is hidden by
1057 a type decl. Got all that? */
1060 PTYPENAME
'<' template_arg_list_opt template_close_bracket
1061 .finish_template_type
1063 | TYPENAME
'<' template_arg_list_opt template_close_bracket
1064 .finish_template_type
1066 | self_template_type
1069 apparent_template_type:
1071 | identifier
'<' template_arg_list_opt
'>'
1072 .finish_template_type
1077 SELFNAME
'<' template_arg_list_opt template_close_bracket
1078 .finish_template_type
1082 .finish_template_type
:
1084 if
(yychar == YYEMPTY
)
1087 $$
= finish_template_type
($
<ttype
>-3, $
<ttype
>-1,
1092 template_close_bracket:
1096 /* Handle `Class<Class<Type>>' without space in the `>>' */
1097 pedwarn
("`>>' should be `> >' in template class name");
1102 template_arg_list_opt:
1110 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1111 | template_arg_list
',' template_arg
1112 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1117 { $$
= groktypename
($1.t
); }
1121 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1122 $$
= TREE_TYPE
($$
);
1124 | global_scope PTYPENAME
1127 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1128 $$
= TREE_TYPE
($$
);
1130 | expr_no_comma_rangle
1131 | nested_name_specifier TEMPLATE identifier
1133 if
(!processing_template_decl
)
1135 error ("use of template qualifier outside template");
1136 $$
= error_mark_node
;
1139 $$
= make_unbound_class_template
($1, $3, 1);
1145 { $$
= NEGATE_EXPR
; }
1147 { $$
= CONVERT_EXPR
; }
1149 { $$
= PREINCREMENT_EXPR
; }
1151 { $$
= PREDECREMENT_EXPR
; }
1153 { $$
= TRUTH_NOT_EXPR
; }
1158 { $$
= build_x_compound_expr
($$
); }
1164 { error ("ISO C++ forbids an empty condition for `%s'",
1166 $$
= integer_zero_node
; }
1173 { error ("ISO C++ forbids an empty condition for `%s'",
1175 $$
= integer_zero_node
; }
1189 type_specifier_seq declarator maybeasm maybe_attribute
'='
1192 for
(d
= getdecls
(); d
; d
= TREE_CHAIN
(d
))
1193 if
(TREE_CODE
(d
) == TYPE_DECL
) {
1194 tree s
= TREE_TYPE
(d
);
1195 if
(TREE_CODE
(s
) == RECORD_TYPE
)
1196 error ("definition of class `%T' in condition", s
);
1197 else if
(TREE_CODE
(s
) == ENUMERAL_TYPE
)
1198 error ("definition of enum `%T' in condition", s
);
1201 current_declspecs
= $1.t
;
1202 $
<ttype
>$
= parse_decl
($
<ttype
>2, $4, 1);
1206 parse_end_decl
($
<ttype
>6, $7, $4);
1207 $$
= convert_from_reference
($
<ttype
>6);
1208 if
(TREE_CODE
(TREE_TYPE
($$
)) == ARRAY_TYPE
)
1209 error ("definition of array `%#D' in condition", $$
);
1216 | maybe_label_decls stmts
'}'
1217 | maybe_label_decls stmts
error '}'
1218 | maybe_label_decls
error '}'
1221 nontrivial_exprlist:
1222 expr_no_commas
',' expr_no_commas
1223 { $$
= tree_cons
(NULL_TREE
, $$
,
1224 build_tree_list
(NULL_TREE
, $3)); }
1225 | expr_no_commas
',' error
1226 { $$
= tree_cons
(NULL_TREE
, $$
,
1227 build_tree_list
(NULL_TREE
, error_mark_node
)); }
1228 | nontrivial_exprlist
',' expr_no_commas
1229 { chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1230 | nontrivial_exprlist
',' error
1231 { chainon
($$
, build_tree_list
(NULL_TREE
, error_mark_node
)); }
1236 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1237 | nontrivial_exprlist
1243 /* __extension__ turns off -pedantic for following primary. */
1244 | extension cast_expr %prec UNARY
1247 |
'*' cast_expr %prec UNARY
1248 { $$
= build_x_indirect_ref
($2, "unary *"); }
1249 |
'&' cast_expr %prec UNARY
1250 { $$
= build_x_unary_op
(ADDR_EXPR
, $2); }
1252 { $$
= build_x_unary_op
(BIT_NOT_EXPR
, $2); }
1253 | unop cast_expr %prec UNARY
1254 { $$
= finish_unary_op_expr
($1, $2); }
1255 /* Refer to the address of a label as a pointer. */
1257 { $$
= finish_label_address_expr
($2); }
1258 | sizeof unary_expr %prec UNARY
1259 { $$
= finish_sizeof
($2);
1260 skip_evaluation
--; }
1261 | sizeof
'(' type_id
')' %prec HYPERUNARY
1262 { $$
= finish_sizeof
(groktypename
($3.t
));
1263 check_for_new_type
("sizeof", $3);
1264 skip_evaluation
--; }
1265 | alignof unary_expr %prec UNARY
1266 { $$
= finish_alignof
($2);
1267 skip_evaluation
--; }
1268 | alignof
'(' type_id
')' %prec HYPERUNARY
1269 { $$
= finish_alignof
(groktypename
($3.t
));
1270 check_for_new_type
("alignof", $3);
1271 skip_evaluation
--; }
1273 /* The %prec EMPTY's here are required by the = init initializer
1274 syntax extension; see below. */
1275 | new new_type_id %prec EMPTY
1276 { $$
= build_new
(NULL_TREE
, $2.t
, NULL_TREE
, $1);
1277 check_for_new_type
("new", $2); }
1278 | new new_type_id new_initializer
1279 { $$
= build_new
(NULL_TREE
, $2.t
, $3, $1);
1280 check_for_new_type
("new", $2); }
1281 | new new_placement new_type_id %prec EMPTY
1282 { $$
= build_new
($2, $3.t
, NULL_TREE
, $1);
1283 check_for_new_type
("new", $3); }
1284 | new new_placement new_type_id new_initializer
1285 { $$
= build_new
($2, $3.t
, $4, $1);
1286 check_for_new_type
("new", $3); }
1287 | new
'(' type_id
')'
1289 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
),
1291 check_for_new_type
("new", $3); }
1292 | new
'(' type_id
')' new_initializer
1293 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
), $5, $1);
1294 check_for_new_type
("new", $3); }
1295 | new new_placement
'(' type_id
')' %prec EMPTY
1296 { $$
= build_new
($2, groktypename
($4.t
), NULL_TREE
, $1);
1297 check_for_new_type
("new", $4); }
1298 | new new_placement
'(' type_id
')' new_initializer
1299 { $$
= build_new
($2, groktypename
($4.t
), $6, $1);
1300 check_for_new_type
("new", $4); }
1302 | delete cast_expr %prec UNARY
1303 { $$
= delete_sanity
($2, NULL_TREE
, 0, $1); }
1304 | delete
'[' ']' cast_expr %prec UNARY
1305 { $$
= delete_sanity
($4, NULL_TREE
, 1, $1);
1306 if
(yychar == YYEMPTY
)
1308 | delete
'[' expr
']' cast_expr %prec UNARY
1309 { $$
= delete_sanity
($5, $3, 2, $1);
1310 if
(yychar == YYEMPTY
)
1312 | REALPART cast_expr %prec UNARY
1313 { $$
= build_x_unary_op
(REALPART_EXPR
, $2); }
1314 | IMAGPART cast_expr %prec UNARY
1315 { $$
= build_x_unary_op
(IMAGPART_EXPR
, $2); }
1319 '(' nonnull_exprlist
')'
1321 |
'{' nonnull_exprlist
'}'
1322 { pedwarn
("old style placement syntax, use () instead");
1327 '(' nonnull_exprlist
')'
1330 { $$
= void_zero_node
; }
1333 error ("`%T' is not a valid expression", $2.t
);
1334 $$
= error_mark_node
;
1336 /* GNU extension so people can use initializer lists. Note that
1337 this alters the meaning of `new int = 1', which was previously
1338 syntactically valid but semantically invalid.
1339 This feature is now deprecated and will be removed in a future
1344 pedwarn
("ISO C++ forbids initialization of new expression with `='");
1345 cp_deprecated
("new initializer lists extension");
1346 if
(TREE_CODE
($2) != TREE_LIST
1347 && TREE_CODE
($2) != CONSTRUCTOR
)
1348 $$
= build_tree_list
(NULL_TREE
, $2);
1354 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1356 '(' type_id
')' %prec EMPTY
1357 { $2.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $2.t
), 0);
1358 $$
= make_call_declarator
(NULL_TREE
, $2.t
, NULL_TREE
, NULL_TREE
);
1359 check_for_new_type
("cast", $2); }
1360 | regcast_or_absdcl
'(' type_id
')' %prec EMPTY
1361 { $3.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $3.t
), 0);
1362 $$
= make_call_declarator
($$
, $3.t
, NULL_TREE
, NULL_TREE
);
1363 check_for_new_type
("cast", $3); }
1368 | regcast_or_absdcl unary_expr %prec UNARY
1369 { $$
= reparse_absdcl_as_casts
($$
, $2); }
1370 | regcast_or_absdcl
'{' initlist maybecomma
'}' %prec UNARY
1372 tree init
= build_nt
(CONSTRUCTOR
, NULL_TREE
,
1375 pedwarn
("ISO C++ forbids compound literals");
1376 /* Indicate that this was a C99 compound literal. */
1377 TREE_HAS_CONSTRUCTOR
(init
) = 1;
1379 $$
= reparse_absdcl_as_casts
($$
, init
);
1385 /* Handle general members. */
1386 | expr_no_commas POINTSAT_STAR expr_no_commas
1387 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1388 | expr_no_commas DOT_STAR expr_no_commas
1389 { $$
= build_m_component_ref
($$
, $3); }
1390 | expr_no_commas
'+' expr_no_commas
1391 { $$
= build_x_binary_op
($2, $$
, $3); }
1392 | expr_no_commas
'-' expr_no_commas
1393 { $$
= build_x_binary_op
($2, $$
, $3); }
1394 | expr_no_commas
'*' expr_no_commas
1395 { $$
= build_x_binary_op
($2, $$
, $3); }
1396 | expr_no_commas
'/' expr_no_commas
1397 { $$
= build_x_binary_op
($2, $$
, $3); }
1398 | expr_no_commas
'%' expr_no_commas
1399 { $$
= build_x_binary_op
($2, $$
, $3); }
1400 | expr_no_commas LSHIFT expr_no_commas
1401 { $$
= build_x_binary_op
($2, $$
, $3); }
1402 | expr_no_commas RSHIFT expr_no_commas
1403 { $$
= build_x_binary_op
($2, $$
, $3); }
1404 | expr_no_commas ARITHCOMPARE expr_no_commas
1405 { $$
= build_x_binary_op
($2, $$
, $3); }
1406 | expr_no_commas
'<' expr_no_commas
1407 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1408 | expr_no_commas
'>' expr_no_commas
1409 { $$
= build_x_binary_op
(GT_EXPR
, $$
, $3); }
1410 | expr_no_commas EQCOMPARE expr_no_commas
1411 { $$
= build_x_binary_op
($2, $$
, $3); }
1412 | expr_no_commas MIN_MAX expr_no_commas
1413 { $$
= build_x_binary_op
($2, $$
, $3); }
1414 | expr_no_commas
'&' expr_no_commas
1415 { $$
= build_x_binary_op
($2, $$
, $3); }
1416 | expr_no_commas
'|' expr_no_commas
1417 { $$
= build_x_binary_op
($2, $$
, $3); }
1418 | expr_no_commas
'^' expr_no_commas
1419 { $$
= build_x_binary_op
($2, $$
, $3); }
1420 | expr_no_commas ANDAND expr_no_commas
1421 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1422 | expr_no_commas OROR expr_no_commas
1423 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1424 | expr_no_commas
'?' xexpr
':' expr_no_commas
1425 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1426 | expr_no_commas
'=' expr_no_commas
1427 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1428 if
($$
!= error_mark_node
)
1429 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1430 | expr_no_commas ASSIGN expr_no_commas
1431 { $$
= build_x_modify_expr
($$
, $2, $3); }
1433 { $$
= build_throw
(NULL_TREE
); }
1434 | THROW expr_no_commas
1435 { $$
= build_throw
($2); }
1438 expr_no_comma_rangle:
1440 /* Handle general members. */
1441 | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
1442 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1443 | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
1444 { $$
= build_m_component_ref
($$
, $3); }
1445 | expr_no_comma_rangle
'+' expr_no_comma_rangle
1446 { $$
= build_x_binary_op
($2, $$
, $3); }
1447 | expr_no_comma_rangle
'-' expr_no_comma_rangle
1448 { $$
= build_x_binary_op
($2, $$
, $3); }
1449 | expr_no_comma_rangle
'*' expr_no_comma_rangle
1450 { $$
= build_x_binary_op
($2, $$
, $3); }
1451 | expr_no_comma_rangle
'/' expr_no_comma_rangle
1452 { $$
= build_x_binary_op
($2, $$
, $3); }
1453 | expr_no_comma_rangle
'%' expr_no_comma_rangle
1454 { $$
= build_x_binary_op
($2, $$
, $3); }
1455 | expr_no_comma_rangle LSHIFT expr_no_comma_rangle
1456 { $$
= build_x_binary_op
($2, $$
, $3); }
1457 | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
1458 { $$
= build_x_binary_op
($2, $$
, $3); }
1459 | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
1460 { $$
= build_x_binary_op
($2, $$
, $3); }
1461 | expr_no_comma_rangle
'<' expr_no_comma_rangle
1462 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1463 | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
1464 { $$
= build_x_binary_op
($2, $$
, $3); }
1465 | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
1466 { $$
= build_x_binary_op
($2, $$
, $3); }
1467 | expr_no_comma_rangle
'&' expr_no_comma_rangle
1468 { $$
= build_x_binary_op
($2, $$
, $3); }
1469 | expr_no_comma_rangle
'|' expr_no_comma_rangle
1470 { $$
= build_x_binary_op
($2, $$
, $3); }
1471 | expr_no_comma_rangle
'^' expr_no_comma_rangle
1472 { $$
= build_x_binary_op
($2, $$
, $3); }
1473 | expr_no_comma_rangle ANDAND expr_no_comma_rangle
1474 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1475 | expr_no_comma_rangle OROR expr_no_comma_rangle
1476 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1477 | expr_no_comma_rangle
'?' xexpr
':' expr_no_comma_rangle
1478 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1479 | expr_no_comma_rangle
'=' expr_no_comma_rangle
1480 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1481 if
($$
!= error_mark_node
)
1482 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1483 | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
1484 { $$
= build_x_modify_expr
($$
, $2, $3); }
1486 { $$
= build_throw
(NULL_TREE
); }
1487 | THROW expr_no_comma_rangle
1488 { $$
= build_throw
($2); }
1491 notype_unqualified_id:
1492 '~' see_typename identifier
1493 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1494 |
'~' see_typename template_type
1495 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1500 | NSNAME %prec EMPTY
1505 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1506 means that we're in an expression like S::f<int>, so
1507 don't do_identifier; we only do that for unqualified
1509 if
(!lastiddecl || TREE_CODE
(lastiddecl
) != TREE_LIST
)
1510 $$
= do_identifier
($
<ttype
>-1, 3, NULL_TREE
);
1517 PFUNCNAME
'<' do_id template_arg_list_opt template_close_bracket
1518 { $$
= lookup_template_function
($3, $4); }
1519 | operator_name
'<' do_id template_arg_list_opt template_close_bracket
1520 { $$
= lookup_template_function
($3, $4); }
1524 TEMPLATE identifier
'<' template_arg_list_opt template_close_bracket
1525 { $$
= lookup_template_function
($2, $4); }
1526 | TEMPLATE PFUNCNAME
'<' template_arg_list_opt template_close_bracket
1527 { $$
= lookup_template_function
($2, $4); }
1528 | TEMPLATE operator_name
'<' template_arg_list_opt
1529 template_close_bracket
1530 { $$
= lookup_template_function
($2, $4); }
1534 notype_unqualified_id
1539 expr_or_declarator_intern:
1541 | attributes expr_or_declarator
1543 /* Provide support for '(' attributes '*' declarator ')'
1545 $$
= tree_cons
($1, $2, NULL_TREE
);
1550 notype_unqualified_id
1551 |
'*' expr_or_declarator_intern %prec UNARY
1552 { $$
= build_nt
(INDIRECT_REF
, $2); }
1553 |
'&' expr_or_declarator_intern %prec UNARY
1554 { $$
= build_nt
(ADDR_EXPR
, $2); }
1555 |
'(' expr_or_declarator_intern
')'
1559 notype_template_declarator:
1560 IDENTIFIER
'<' template_arg_list_opt template_close_bracket
1561 { $$
= lookup_template_function
($1, $3); }
1562 | NSNAME
'<' template_arg_list template_close_bracket
1563 { $$
= lookup_template_function
($1, $3); }
1566 direct_notype_declarator:
1567 complex_direct_notype_declarator
1568 /* This precedence declaration is to prefer this reduce
1569 to the Koenig lookup shift in primary, below. I hate yacc. */
1570 | notype_unqualified_id %prec
'('
1571 | notype_template_declarator
1572 |
'(' expr_or_declarator_intern
')'
1573 { $$
= finish_decl_parsing
($2); }
1577 notype_unqualified_id
1579 if
(TREE_CODE
($1) == BIT_NOT_EXPR
)
1580 $$
= build_x_unary_op
(BIT_NOT_EXPR
, TREE_OPERAND
($1, 0));
1582 $$
= finish_id_expr
($1);
1588 $$
= combine_strings
($$
);
1589 /* combine_strings doesn't set up TYPE_MAIN_VARIANT of
1590 a const array the way we want, so fix it. */
1591 if
(flag_const_strings
)
1592 TREE_TYPE
($$
) = build_cplus_array_type
1593 (TREE_TYPE
(TREE_TYPE
($$
)),
1594 TYPE_DOMAIN
(TREE_TYPE
($$
)));
1598 $$
= fname_decl
(C_RID_CODE
($$
), $$
);
1599 if
(processing_template_decl
)
1600 $$
= build_min_nt
(LOOKUP_EXPR
, DECL_NAME
($$
));
1603 { $$
= finish_parenthesized_expr
($2); }
1604 |
'(' expr_or_declarator_intern
')'
1605 { $2 = reparse_decl_as_expr
(NULL_TREE
, $2);
1606 $$
= finish_parenthesized_expr
($2); }
1608 { $$
= error_mark_node
; }
1610 { tree scope
= current_scope
();
1611 if
(!scope || TREE_CODE
(scope
) != FUNCTION_DECL
)
1613 error ("braced-group within expression allowed only inside a function");
1617 pedwarn
("ISO C++ forbids braced-groups within expressions");
1618 $
<ttype
>$
= begin_stmt_expr
();
1620 compstmt_or_stmtexpr
')'
1621 { $$
= finish_stmt_expr
($
<ttype
>2); }
1622 /* Koenig lookup support
1623 We could store lastiddecl in $1 to avoid another lookup,
1624 but that would result in many additional reduce/reduce conflicts. */
1625 | notype_unqualified_id
'(' nonnull_exprlist
')'
1626 { $$
= finish_call_expr
($1, $3, 1); }
1627 | notype_unqualified_id LEFT_RIGHT
1628 { $$
= finish_call_expr
($1, NULL_TREE
, 1); }
1629 | primary
'(' nonnull_exprlist
')'
1630 { $$
= finish_call_expr
($1, $3, 0); }
1631 | primary LEFT_RIGHT
1632 { $$
= finish_call_expr
($1, NULL_TREE
, 0); }
1633 | VA_ARG
'(' expr_no_commas
',' type_id
')'
1634 { $$
= build_x_va_arg
($3, groktypename
($5.t
));
1635 check_for_new_type
("__builtin_va_arg", $5); }
1636 | primary
'[' expr
']'
1637 { $$
= grok_array_decl
($$
, $3); }
1639 { $$
= finish_increment_expr
($1, POSTINCREMENT_EXPR
); }
1640 | primary MINUSMINUS
1641 { $$
= finish_increment_expr
($1, POSTDECREMENT_EXPR
); }
1642 /* C++ extensions */
1644 { $$
= finish_this_expr
(); }
1645 | CV_QUALIFIER
'(' nonnull_exprlist
')'
1647 /* This is a C cast in C++'s `functional' notation
1648 using the "implicit int" extension so that:
1649 `const (3)' is equivalent to `const int (3)'. */
1652 type
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1653 type
= groktypename
(build_tree_list
(type
, NULL_TREE
));
1654 $$
= build_functional_cast
(type
, $3);
1657 | DYNAMIC_CAST
'<' type_id
'>' '(' expr
')'
1658 { tree type
= groktypename
($3.t
);
1659 check_for_new_type
("dynamic_cast", $3);
1660 $$
= build_dynamic_cast
(type
, $6); }
1661 | STATIC_CAST
'<' type_id
'>' '(' expr
')'
1662 { tree type
= groktypename
($3.t
);
1663 check_for_new_type
("static_cast", $3);
1664 $$
= build_static_cast
(type
, $6); }
1665 | REINTERPRET_CAST
'<' type_id
'>' '(' expr
')'
1666 { tree type
= groktypename
($3.t
);
1667 check_for_new_type
("reinterpret_cast", $3);
1668 $$
= build_reinterpret_cast
(type
, $6); }
1669 | CONST_CAST
'<' type_id
'>' '(' expr
')'
1670 { tree type
= groktypename
($3.t
);
1671 check_for_new_type
("const_cast", $3);
1672 $$
= build_const_cast
(type
, $6); }
1673 | TYPEID
'(' expr
')'
1674 { $$
= build_typeid
($3); }
1675 | TYPEID
'(' type_id
')'
1676 { tree type
= groktypename
($3.t
);
1677 check_for_new_type
("typeid", $3);
1678 $$
= get_typeid
(type
); }
1679 | global_scope IDENTIFIER
1680 { $$
= do_scoped_id
($2, 1); }
1681 | global_scope template_id
1683 | global_scope operator_name
1685 got_scope
= NULL_TREE
;
1686 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
1687 $$
= do_scoped_id
($2, 1);
1691 | overqualified_id %prec HYPERUNARY
1692 { $$
= build_offset_ref
(OP0
($$
), OP1
($$
)); }
1693 | overqualified_id
'(' nonnull_exprlist
')'
1694 { $$
= finish_qualified_call_expr
($1, $3); }
1695 | overqualified_id LEFT_RIGHT
1696 { $$
= finish_qualified_call_expr
($1, NULL_TREE
); }
1697 | object object_template_id %prec UNARY
1699 $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1);
1701 | object object_template_id
'(' nonnull_exprlist
')'
1702 { $$
= finish_object_call_expr
($2, $1, $4); }
1703 | object object_template_id LEFT_RIGHT
1704 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1705 | object unqualified_id %prec UNARY
1706 { $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1); }
1707 | object overqualified_id %prec UNARY
1708 { if
(processing_template_decl
)
1709 $$
= build_min_nt
(COMPONENT_REF
, $1, $2);
1711 $$
= build_object_ref
($$
, OP0
($2), OP1
($2)); }
1712 | object unqualified_id
'(' nonnull_exprlist
')'
1713 { $$
= finish_object_call_expr
($2, $1, $4); }
1714 | object unqualified_id LEFT_RIGHT
1715 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1716 | object overqualified_id
'(' nonnull_exprlist
')'
1717 { $$
= finish_qualified_object_call_expr
($2, $1, $4); }
1718 | object overqualified_id LEFT_RIGHT
1719 { $$
= finish_qualified_object_call_expr
($2, $1, NULL_TREE
); }
1720 /* p->int::~int() is valid -- 12.4 */
1721 | object
'~' TYPESPEC LEFT_RIGHT
1722 { $$
= finish_pseudo_destructor_call_expr
($1, NULL_TREE
, $3); }
1723 | object TYPESPEC SCOPE
'~' TYPESPEC LEFT_RIGHT
1724 { $$
= finish_pseudo_destructor_call_expr
($1, $2, $5); }
1727 $$
= error_mark_node
;
1731 /* Not needed for now.
1737 { $$ = error_mark_node; }
1739 { if (current_function_decl == 0)
1741 error ("braced-group within expression allowed only inside a function");
1744 $<ttype>$ = expand_start_stmt_expr (); }
1745 compstmt_or_stmtexpr ')'
1747 pedwarn ("ISO C++ forbids braced-groups within expressions");
1748 $$ = expand_end_stmt_expr ($<ttype>2); }
1749 | primary_no_id '(' nonnull_exprlist ')'
1750 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1751 | primary_no_id LEFT_RIGHT
1752 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1753 | primary_no_id '[' expr ']'
1755 | primary_no_id PLUSPLUS
1756 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1757 | primary_no_id MINUSMINUS
1758 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1760 { goto do_scoped_id; }
1761 | SCOPE operator_name
1762 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1764 goto do_scoped_operator;
1773 { got_scope
= NULL_TREE
; $$
= 1; }
1779 | global_scope delete
1780 { got_scope
= NULL_TREE
; $$
= 1; }
1785 { $$
= boolean_true_node
; }
1787 { $$
= boolean_false_node
; }
1790 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1794 { $$
= chainon
($$
, $2); }
1800 if
(DECL_CONSTRUCTOR_P
(current_function_decl
))
1801 finish_mem_initializers
(NULL_TREE
);
1807 { got_object
= TREE_TYPE
($$
); }
1810 $$
= build_x_arrow
($$
);
1811 got_object
= TREE_TYPE
($$
);
1816 typespec initdecls
';'
1818 if
($1.t
&& IS_AGGR_TYPE_CODE
(TREE_CODE
($1.t
)))
1819 note_got_semicolon
($1.t
);
1821 | typed_declspecs initdecls
';'
1823 note_list_got_semicolon
($1.t
);
1825 | declmods notype_initdecls
';'
1827 | typed_declspecs
';'
1830 note_list_got_semicolon
($1.t
);
1833 { warning
("empty declaration"); }
1838 /* Any kind of declarator (thus, all declarators allowed
1839 after an explicit typespec). */
1842 after_type_declarator %prec EMPTY
1843 | notype_declarator %prec EMPTY
1846 /* This is necessary to postpone reduction of `int()()()()'. */
1848 LEFT_RIGHT %prec EMPTY
1849 { $$
= make_call_declarator
(NULL_TREE
, empty_parms
(),
1850 NULL_TREE
, NULL_TREE
); }
1851 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1852 { $$
= make_call_declarator
($$
, empty_parms
(), NULL_TREE
,
1856 /* ISO type-id (8.1) */
1858 typed_typespecs absdcl
1859 { $$.t
= build_tree_list
($1.t
, $2);
1860 $$.new_type_flag
= $1.new_type_flag
; }
1861 | nonempty_cv_qualifiers absdcl
1862 { $$.t
= build_tree_list
($1.t
, $2);
1863 $$.new_type_flag
= $1.new_type_flag
; }
1865 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
1867 $$.new_type_flag
= $1.new_type_flag
; }
1868 | typed_typespecs %prec EMPTY
1869 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1870 $$.new_type_flag
= $1.new_type_flag
; }
1871 | nonempty_cv_qualifiers %prec EMPTY
1872 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1873 $$.new_type_flag
= $1.new_type_flag
; }
1876 /* Declspecs which contain at least one type specifier or typedef name.
1877 (Just `const' or `volatile' is not enough.)
1878 A typedef'd name following these is taken as a name to be declared.
1879 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1882 typed_typespecs %prec EMPTY
1883 { $$.lookups
= type_lookups
; }
1885 { $$.lookups
= type_lookups
; }
1890 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1891 $$.new_type_flag
= $2.new_type_flag
; }
1892 | typespec reserved_declspecs %prec HYPERUNARY
1893 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1894 $$.new_type_flag
= $1.new_type_flag
; }
1895 | typespec reserved_typespecquals reserved_declspecs
1896 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, chainon
($2, $3));
1897 $$.new_type_flag
= $1.new_type_flag
; }
1898 | declmods typespec reserved_declspecs
1899 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1900 $$.new_type_flag
= $2.new_type_flag
; }
1901 | declmods typespec reserved_typespecquals
1902 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1903 $$.new_type_flag
= $2.new_type_flag
; }
1904 | declmods typespec reserved_typespecquals reserved_declspecs
1905 { $$.t
= tree_cons
(NULL_TREE
, $2.t
,
1906 chainon
($3, chainon
($4, $1.t
)));
1907 $$.new_type_flag
= $2.new_type_flag
; }
1912 { if
(extra_warnings
)
1913 warning
("`%s' is not at beginning of declaration",
1914 IDENTIFIER_POINTER
($$
));
1915 $$
= build_tree_list
(NULL_TREE
, $$
); }
1916 | reserved_declspecs typespecqual_reserved
1917 { $$
= tree_cons
(NULL_TREE
, $2.t
, $$
); }
1918 | reserved_declspecs SCSPEC
1919 { if
(extra_warnings
)
1920 warning
("`%s' is not at beginning of declaration",
1921 IDENTIFIER_POINTER
($2));
1922 $$
= tree_cons
(NULL_TREE
, $2, $$
); }
1925 /* List of just storage classes and type modifiers.
1926 A declaration can start with just this, but then it cannot be used
1927 to redeclare a typedef-name.
1928 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1930 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1931 up on a persistent obstack. Otherwise, they could appear at the
1932 beginning of something like
1934 static const struct { int foo () { } } b;
1936 and would be discarded after we finish compiling foo. We don't need to
1937 worry once we see a type. */
1940 nonempty_cv_qualifiers %prec EMPTY
1941 { $$.lookups
= NULL_TREE
; TREE_STATIC
($$.t
) = 1; }
1944 $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1945 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1947 | declmods CV_QUALIFIER
1949 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1950 TREE_STATIC
($$.t
) = 1;
1954 if
(extra_warnings
&& TREE_STATIC
($$.t
))
1955 warning
("`%s' is not at beginning of declaration",
1956 IDENTIFIER_POINTER
($2));
1957 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1958 TREE_STATIC
($$.t
) = TREE_STATIC
($1.t
);
1960 | declmods attributes
1961 { $$.t
= hash_tree_cons
($2, NULL_TREE
, $1.t
); }
1964 /* Used instead of declspecs where storage classes are not allowed
1965 (that is, for typenames and structure components).
1967 C++ can takes storage classes for structure components.
1968 Don't accept a typedef-name if anything but a modifier precedes it. */
1971 typespec %prec EMPTY
1972 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
1973 $$.new_type_flag
= $1.new_type_flag
; }
1974 | nonempty_cv_qualifiers typespec
1975 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1976 $$.new_type_flag
= $2.new_type_flag
; }
1977 | typespec reserved_typespecquals
1978 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1979 $$.new_type_flag
= $1.new_type_flag
; }
1980 | nonempty_cv_qualifiers typespec reserved_typespecquals
1981 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1982 $$.new_type_flag
= $2.new_type_flag
; }
1985 reserved_typespecquals:
1986 typespecqual_reserved
1987 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
1988 | reserved_typespecquals typespecqual_reserved
1989 { $$
= tree_cons
(NULL_TREE
, $2.t
, $1); }
1990 | reserved_typespecquals attributes
1991 { $$
= tree_cons
($2, NULL_TREE
, $1); }
1992 | attributes %prec EMPTY
1993 { $$
= tree_cons
($1, NULL_TREE
, NULL_TREE
); }
1997 SIZEOF
{ skip_evaluation
++; }
2001 ALIGNOF
{ skip_evaluation
++; }
2005 TYPEOF
{ skip_evaluation
++; }
2008 /* A typespec (but not a type qualifier).
2009 Once we have seen one of these in a declaration,
2010 if a typedef name appears then it is being redeclared. */
2014 { $$.lookups
= NULL_TREE
; }
2015 | TYPESPEC %prec EMPTY
2016 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
2017 | complete_type_name
2018 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
2019 | typeof
'(' expr
')'
2020 { $$.t
= finish_typeof
($3);
2021 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2022 skip_evaluation
--; }
2023 | typeof
'(' type_id
')'
2024 { $$.t
= groktypename
($3.t
);
2025 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2026 skip_evaluation
--; }
2027 | SIGOF
'(' expr
')'
2028 { tree type
= TREE_TYPE
($3);
2030 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2031 if
(IS_AGGR_TYPE
(type
))
2033 sorry
("sigof type specifier");
2038 error ("`sigof' applied to non-aggregate expression");
2039 $$.t
= error_mark_node
;
2042 | SIGOF
'(' type_id
')'
2043 { tree type
= groktypename
($3.t
);
2045 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2046 if
(IS_AGGR_TYPE
(type
))
2048 sorry
("sigof type specifier");
2053 error("`sigof' applied to non-aggregate type");
2054 $$.t
= error_mark_node
;
2059 /* A typespec that is a reserved word, or a type qualifier. */
2061 typespecqual_reserved:
2063 { $$.t
= $1; $$.new_type_flag
= 0; }
2065 { $$.t
= $1; $$.new_type_flag
= 0; }
2071 | initdecls
',' initdcl
2072 { check_multiple_declarators
(); }
2077 | notype_initdecls
',' initdcl
2078 { check_multiple_declarators
(); }
2083 | nomods_initdecls
',' initdcl
2084 { check_multiple_declarators
(); }
2090 | asm_keyword
'(' string ')'
2091 { if
(TREE_CHAIN
($3)) $3 = combine_strings
($3); $$
= $3; }
2095 declarator maybeasm maybe_attribute
'='
2096 { $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 1); }
2098 /* Note how the declaration of the variable is in effect while its init is parsed! */
2099 { parse_end_decl
($
<ttype
>5, $6, $2); }
2100 | declarator maybeasm maybe_attribute
2102 $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 0);
2103 parse_end_decl
($
<ttype
>$
, NULL_TREE
, $2);
2107 /* This rule assumes a certain configuration of the parser stack.
2108 In particular, $0, the element directly before the beginning of
2109 this rule on the stack, must be a maybeasm. $-1 must be a
2110 declarator or notype_declarator. And $-2 must be some declmods
2111 or declspecs. We can't move the maybeasm into this rule because
2112 we need that reduce so we prefer fn.def1 when appropriate. */
2115 { $
<ttype
>$
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2116 $
<ftype
>-2.lookups
, $1, 1); }
2117 /* Note how the declaration of the variable is in effect
2118 while its init is parsed! */
2120 { parse_end_decl
($
<ttype
>3, $4, $
<ttype
>0); }
2122 { tree d
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2123 $
<ftype
>-2.lookups
, $1, 0);
2124 parse_end_decl
(d
, NULL_TREE
, $
<ttype
>0); }
2128 declarator maybeasm initdcl0_innards
2133 notype_declarator maybeasm initdcl0_innards
2138 notype_declarator maybeasm
2139 { /* Set things up as initdcl0_innards expects. */
2142 $
<ftype
>1.t
= NULL_TREE
;
2143 $
<ftype
>1.lookups
= NULL_TREE
; }
2146 | constructor_declarator maybeasm maybe_attribute
2147 { tree d
= parse_decl0
($1, NULL_TREE
, NULL_TREE
, $3, 0);
2148 parse_end_decl
(d
, NULL_TREE
, $2); }
2151 /* the * rules are dummies to accept the Apollo extended syntax
2152 so that the header files compile. */
2163 | attributes attribute
2164 { $$
= chainon
($1, $2); }
2168 ATTRIBUTE
'(' '(' attribute_list
')' ')'
2175 | attribute_list
',' attrib
2176 { $$
= chainon
($1, $3); }
2183 { $$
= build_tree_list
($1, NULL_TREE
); }
2184 | any_word
'(' IDENTIFIER
')'
2185 { $$
= build_tree_list
($1, build_tree_list
(NULL_TREE
, $3)); }
2186 | any_word
'(' IDENTIFIER
',' nonnull_exprlist
')'
2187 { $$
= build_tree_list
($1, tree_cons
(NULL_TREE
, $3, $5)); }
2188 | any_word
'(' nonnull_exprlist
')'
2189 { $$
= build_tree_list
($1, $3); }
2192 /* This still leaves out most reserved keywords,
2193 shouldn't we include them? */
2202 /* A nonempty list of identifiers, including typenames. */
2203 identifiers_or_typenames:
2205 { $$
= build_tree_list
(NULL_TREE
, $1); }
2206 | identifiers_or_typenames
',' identifier
2207 { $$
= chainon
($1, build_tree_list
(NULL_TREE
, $3)); }
2211 /* empty */ %prec EMPTY
2217 /* If we are processing a template, we don't want to expand this
2221 expr_no_commas %prec
'='
2223 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, NULL_TREE
);
2224 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2226 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2227 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2228 |
'{' initlist
',' '}'
2229 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2230 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2235 /* This chain is built in reverse order,
2236 and put in forward order where initlist is used. */
2239 { $$
= build_tree_list
(NULL_TREE
, $$
); }
2241 { $$
= tree_cons
(NULL_TREE
, $3, $$
); }
2242 /* These are for labeled elements. */
2243 |
'[' expr_no_commas
']' init
2244 { $$
= build_tree_list
($2, $4); }
2245 | identifier
':' init
2246 { $$
= build_tree_list
($$
, $3); }
2247 | initlist
',' identifier
':' init
2248 { $$
= tree_cons
($3, $5, $$
); }
2252 PRE_PARSED_FUNCTION_DECL maybe_return_init function_body
2254 expand_body
(finish_function
(2));
2255 process_next_inline
($1);
2257 | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
2259 expand_body
(finish_function
(2));
2260 process_next_inline
($1);
2262 | PRE_PARSED_FUNCTION_DECL maybe_return_init
error
2264 finish_function
(2);
2265 process_next_inline
($1); }
2270 | pending_inlines pending_inline eat_saved_input
2273 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2274 the TREE_LIST node for the parameter in question. */
2276 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2277 { replace_defarg
($1, $2); }
2278 | DEFARG_MARKER
error END_OF_SAVED_INPUT
2279 { replace_defarg
($1, error_mark_node
); }
2283 /* empty */ %prec EMPTY
2284 | pending_defargs defarg_again
2285 { do_pending_defargs
(); }
2286 | pending_defargs
error
2287 { do_pending_defargs
(); }
2292 { $
<ttype
>$
= current_enum_type
;
2293 current_enum_type
= start_enum
($2); }
2295 { $$.t
= current_enum_type
;
2296 finish_enum
(current_enum_type
);
2297 $$.new_type_flag
= 1;
2298 current_enum_type
= $
<ttype
>4;
2299 check_for_missing_semicolon
($$.t
); }
2301 { $
<ttype
>$
= current_enum_type
;
2302 current_enum_type
= start_enum
(make_anon_name
()); }
2304 { $$.t
= current_enum_type
;
2305 finish_enum
(current_enum_type
);
2306 $$.new_type_flag
= 1;
2307 current_enum_type
= $
<ttype
>3;
2308 check_for_missing_semicolon
($$.t
); }
2310 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2311 $$.new_type_flag
= 0; }
2312 | ENUM complex_type_name
2313 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2314 $$.new_type_flag
= 0; }
2315 | TYPENAME_KEYWORD typename_sub
2317 $$.new_type_flag
= 0;
2318 if
(!processing_template_decl
)
2319 pedwarn
("using `typename' outside of template"); }
2320 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2321 | class_head_defn maybe_base_class_list
'{'
2323 if
($2 && $1.t
!= error_mark_node
)
2325 tree type
= TREE_TYPE
($1.t
);
2327 if
(TREE_CODE
(type
) == TYPENAME_TYPE
)
2328 /* In a definition of a member class template,
2329 we will get here with an implicit typename,
2330 a TYPENAME_TYPE with a type. */
2331 type
= TREE_TYPE
(type
);
2332 maybe_process_partial_specialization
(type
);
2333 xref_basetypes
(current_aggr
, $1.t
, type
, $2);
2335 $1.t
= begin_class_definition
(TREE_TYPE
($1.t
));
2336 check_class_key
(current_aggr
, $1.t
);
2337 current_aggr
= NULL_TREE
; }
2338 opt.component_decl_list
'}' maybe_attribute
2343 if
(yychar == YYEMPTY
)
2345 semi
= yychar == ';';
2347 t
= finish_class_definition
($1.t
, $7, semi
, $1.new_type_flag
);
2350 /* restore current_aggr */
2351 current_aggr
= TREE_CODE
(t
) != RECORD_TYPE
2353 : CLASSTYPE_DECLARED_CLASS
(t
)
2354 ? class_type_node
: record_type_node
;
2358 done_pending_defargs
();
2359 begin_inline_definitions
();
2363 finish_inline_definitions
();
2365 $$.new_type_flag
= 1;
2369 $$.t
= TREE_TYPE
($1.t
);
2370 $$.new_type_flag
= $1.new_type_flag
;
2371 check_class_key
(current_aggr
, $$.t
);
2383 { if
(pedantic
&& !in_system_header
)
2384 pedwarn
("comma at end of enumerator list"); }
2390 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2392 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2394 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2396 { error ("no body nor ';' separates two class, struct or union declarations"); }
2398 { $$
= build_tree_list
($2, $1); }
2405 $$
= build_tree_list
(NULL_TREE
, $2);
2407 | aggr nested_name_specifier identifier
2410 $$
= build_tree_list
($2, $3);
2412 | aggr global_scope nested_name_specifier identifier
2415 $$
= build_tree_list
($3, $4);
2417 | aggr global_scope identifier
2420 $$
= build_tree_list
(global_namespace
, $3);
2424 class_head_apparent_template:
2425 aggr apparent_template_type
2430 | aggr nested_name_specifier apparent_template_type
2435 | aggr global_scope nested_name_specifier apparent_template_type
2443 class_head %prec EMPTY
2445 $$.t
= handle_class_head
(current_aggr
,
2446 TREE_PURPOSE
($1), TREE_VALUE
($1),
2447 0, &$$.new_type_flag
);
2449 | aggr identifier_defn %prec EMPTY
2452 $$.t
= TYPE_MAIN_DECL
(xref_tag
(current_aggr
, $2, 0));
2453 $$.new_type_flag
= 1;
2455 | class_head_apparent_template %prec EMPTY
2458 $$.new_type_flag
= 0;
2466 $$.t
= handle_class_head
(current_aggr
,
2467 TREE_PURPOSE
($1), TREE_VALUE
($1),
2468 1, &$$.new_type_flag
);
2473 $$.t
= handle_class_head
(current_aggr
,
2474 TREE_PURPOSE
($1), TREE_VALUE
($1),
2475 1, &$$.new_type_flag
);
2477 | class_head_apparent_template
'{'
2481 $$.new_type_flag
= 0;
2482 if
(TREE_CODE
(TREE_TYPE
($1)) == RECORD_TYPE
)
2483 /* We might be specializing a template with a different
2485 CLASSTYPE_DECLARED_CLASS
(TREE_TYPE
($1))
2486 = (current_aggr
== class_type_node
);
2488 | class_head_apparent_template
':'
2492 $$.new_type_flag
= 0;
2493 if
(TREE_CODE
(TREE_TYPE
($1)) == RECORD_TYPE
)
2494 /* We might be specializing a template with a different
2496 CLASSTYPE_DECLARED_CLASS
(TREE_TYPE
($1))
2497 = (current_aggr
== class_type_node
);
2499 | aggr identifier_defn
'{'
2503 $$.t
= handle_class_head
(current_aggr
,
2505 1, &$$.new_type_flag
);
2507 | aggr identifier_defn
':'
2511 $$.t
= handle_class_head
(current_aggr
,
2513 1, &$$.new_type_flag
);
2518 $$.t
= TYPE_MAIN_DECL
(xref_tag
($1, make_anon_name
(), 0));
2519 $$.new_type_flag
= 0;
2524 maybe_base_class_list:
2528 { error ("no bases given following `:'");
2530 |
':' see_typename base_class_list
2536 | base_class_list
',' see_typename base_class
2537 { $$
= chainon
($$
, $4); }
2542 { $$
= finish_base_specifier
(access_default_node
, $1); }
2543 | base_class_access_list see_typename base_class
.1
2544 { $$
= finish_base_specifier
($1, $3); }
2550 $$
= error_mark_node
; }
2552 { $$
= TREE_TYPE
($$
); }
2555 base_class_access_list:
2556 VISSPEC see_typename
2557 | SCSPEC see_typename
2558 { if
($1 != ridpointers
[(int)RID_VIRTUAL
])
2559 error ("`%D' access", $1);
2560 $$
= access_default_virtual_node
; }
2561 | base_class_access_list VISSPEC see_typename
2563 if
($1 != access_default_virtual_node
)
2564 error ("multiple access specifiers");
2565 else if
($2 == access_public_node
)
2566 $$
= access_public_virtual_node
;
2567 else if
($2 == access_protected_node
)
2568 $$
= access_protected_virtual_node
;
2569 else
/* $2 == access_private_node */
2570 $$
= access_private_virtual_node
;
2572 | base_class_access_list SCSPEC see_typename
2573 { if
($2 != ridpointers
[(int)RID_VIRTUAL
])
2574 error ("`%D' access", $2);
2575 else if
($$
== access_public_node
)
2576 $$
= access_public_virtual_node
;
2577 else if
($$
== access_protected_node
)
2578 $$
= access_protected_virtual_node
;
2579 else if
($$
== access_private_node
)
2580 $$
= access_private_virtual_node
;
2582 error ("multiple `virtual' specifiers");
2586 opt.component_decl_list
:
2587 | component_decl_list
2588 | opt.component_decl_list access_specifier component_decl_list
2589 | opt.component_decl_list access_specifier
2595 current_access_specifier
= $1;
2599 /* Note: we no longer warn about the semicolon after a component_decl_list.
2600 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2601 component_decl_list:
2604 finish_member_declaration
($1);
2605 current_aggr
= NULL_TREE
;
2606 reset_type_access_control
();
2608 | component_decl_list component_decl
2610 finish_member_declaration
($2);
2611 current_aggr
= NULL_TREE
;
2612 reset_type_access_control
();
2617 component_decl_1
';'
2618 | component_decl_1
'}'
2619 { error ("missing ';' before right brace");
2620 yyungetc
('}', 0); }
2621 /* C++: handle constructors, destructors and inline functions */
2622 /* note that INLINE is like a TYPESPEC */
2623 | fn.def2
':' /* base_init compstmt */
2624 { $$
= finish_method
($$
); }
2625 | fn.def2 TRY
/* base_init compstmt */
2626 { $$
= finish_method
($$
); }
2627 | fn.def2 RETURN_KEYWORD
/* base_init compstmt */
2628 { $$
= finish_method
($$
); }
2629 | fn.def2
'{' /* nodecls compstmt */
2630 { $$
= finish_method
($$
); }
2633 | extension component_decl
2636 | template_header component_decl
2639 $$
= finish_member_template_decl
($2);
2641 /* The component was already processed. */
2644 finish_template_decl
($1);
2646 | template_header typed_declspecs
';'
2648 $$
= finish_member_class_template
($2.t
);
2649 finish_template_decl
($1);
2656 /* Do not add a "typed_declspecs declarator" rule here for
2657 speed; we need to call grok_x_components for enums, so the
2658 speedup would be insignificant. */
2659 typed_declspecs components
2661 /* Most of the productions for component_decl only
2662 allow the creation of one new member, so we call
2663 finish_member_declaration in component_decl_list.
2664 For this rule and the next, however, there can be
2665 more than one member, e.g.:
2669 and we need the first member to be fully
2670 registered before the second is processed.
2671 Therefore, the rules for components take care of
2672 this processing. To avoid registering the
2673 components more than once, we send NULL_TREE up
2674 here; that lets finish_member_declaration know
2675 that there is nothing to do. */
2677 grok_x_components
($1.t
);
2680 | declmods notype_components
2683 grok_x_components
($1.t
);
2686 | notype_declarator maybeasm maybe_attribute maybe_init
2687 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2688 | constructor_declarator maybeasm maybe_attribute maybe_init
2689 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2690 |
':' expr_no_commas
2691 { $$
= grokbitfield
(NULL_TREE
, NULL_TREE
, $2); }
2695 /* These rules introduce a reduce/reduce conflict; in
2696 typedef int foo, bar;
2700 should "A::foo" be declared as a function or "A::bar" as a data
2701 member? In other words, is "bar" an after_type_declarator or a
2703 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2704 { tree specs
, attrs
;
2705 split_specs_attrs
($1.t
, &specs
, &attrs
);
2706 $$
= grokfield
($2, specs
, $5, $3,
2707 chainon
($4, attrs
)); }
2708 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2709 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2711 { $$
= do_class_using_decl
($1); }
2714 /* The case of exactly one component is handled directly by component_decl. */
2717 /* empty: possibly anonymous */
2719 | component_declarator0
2721 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2722 $1 = finish_member_template_decl
($1);
2723 finish_member_declaration
($1);
2726 | components
',' component_declarator
2728 check_multiple_declarators
();
2729 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2730 $3 = finish_member_template_decl
($3);
2731 finish_member_declaration
($3);
2737 /* empty: possibly anonymous */
2739 | notype_component_declarator0
2741 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2742 $1 = finish_member_template_decl
($1);
2743 finish_member_declaration
($1);
2746 | notype_components
',' notype_component_declarator
2748 check_multiple_declarators
();
2749 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2750 $3 = finish_member_template_decl
($3);
2751 finish_member_declaration
($3);
2756 component_declarator0:
2757 after_type_component_declarator0
2758 | notype_component_declarator0
2761 component_declarator:
2762 after_type_component_declarator
2763 | notype_component_declarator
2766 after_type_component_declarator0:
2767 after_type_declarator maybeasm maybe_attribute maybe_init
2768 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2770 | TYPENAME
':' expr_no_commas maybe_attribute
2771 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2775 notype_component_declarator0:
2776 notype_declarator maybeasm maybe_attribute maybe_init
2777 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2779 | constructor_declarator maybeasm maybe_attribute maybe_init
2780 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2782 | IDENTIFIER
':' expr_no_commas maybe_attribute
2783 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2785 |
':' expr_no_commas maybe_attribute
2786 { $$
= parse_bitfield0
(NULL_TREE
, $
<ftype
>0.t
,
2787 $
<ftype
>0.lookups
, $3, $2); }
2790 after_type_component_declarator:
2791 after_type_declarator maybeasm maybe_attribute maybe_init
2792 { $$
= parse_field
($1, $3, $2, $4); }
2793 | TYPENAME
':' expr_no_commas maybe_attribute
2794 { $$
= parse_bitfield
($1, $4, $3); }
2797 notype_component_declarator:
2798 notype_declarator maybeasm maybe_attribute maybe_init
2799 { $$
= parse_field
($1, $3, $2, $4); }
2800 | IDENTIFIER
':' expr_no_commas maybe_attribute
2801 { $$
= parse_bitfield
($1, $4, $3); }
2802 |
':' expr_no_commas maybe_attribute
2803 { $$
= parse_bitfield
(NULL_TREE
, $3, $2); }
2807 enumlist maybecomma_warn
2811 /* We chain the enumerators in reverse order.
2812 Because of the way enums are built, the order is
2813 insignificant. Take advantage of this fact. */
2817 | enumlist
',' enumerator
2822 { build_enumerator
($1, NULL_TREE
, current_enum_type
); }
2823 | identifier
'=' expr_no_commas
2824 { build_enumerator
($1, $3, current_enum_type
); }
2827 /* ISO new-type-id (5.3.4) */
2829 type_specifier_seq new_declarator
2830 { $$.t
= build_tree_list
($1.t
, $2);
2831 $$.new_type_flag
= $1.new_type_flag
; }
2832 | type_specifier_seq %prec EMPTY
2833 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
2834 $$.new_type_flag
= $1.new_type_flag
; }
2835 /* GNU extension to allow arrays of arbitrary types with
2836 non-constant dimension. */
2837 |
'(' type_id
')' '[' expr
']'
2840 pedwarn
("ISO C++ forbids array dimensions with parenthesized type in new");
2841 $$.t
= build_nt
(ARRAY_REF
, TREE_VALUE
($2.t
), $5);
2842 $$.t
= build_tree_list
(TREE_PURPOSE
($2.t
), $$.t
);
2843 $$.new_type_flag
= $2.new_type_flag
;
2848 /* empty */ %prec EMPTY
2850 | cv_qualifiers CV_QUALIFIER
2851 { $$
= tree_cons
(NULL_TREE
, $2, $$
); }
2854 nonempty_cv_qualifiers:
2856 { $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
2857 $$.new_type_flag
= 0; }
2858 | nonempty_cv_qualifiers CV_QUALIFIER
2859 { $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
2860 $$.new_type_flag
= $1.new_type_flag
; }
2861 | attributes %prec EMPTY
2862 { $$.t
= hash_tree_cons
($1, NULL_TREE
, NULL_TREE
);
2863 $$.new_type_flag
= 0; }
2864 | nonempty_cv_qualifiers attributes %prec EMPTY
2865 { $$.t
= hash_tree_cons
($2, NULL_TREE
, $1.t
);
2866 $$.new_type_flag
= $1.new_type_flag
; }
2869 /* These rules must follow the rules for function declarations
2870 and component declarations. That way, longer rules are preferred. */
2872 /* An expression which will not live on the momentary obstack. */
2874 '(' nonnull_exprlist
')'
2879 { $$
= empty_parms
(); }
2884 /* A declarator that is allowed only after an explicit typespec. */
2886 after_type_declarator_intern:
2887 after_type_declarator
2888 | attributes after_type_declarator
2890 /* Provide support for '(' attributes '*' declarator ')'
2892 $$
= tree_cons
($1, $2, NULL_TREE
);
2896 /* may all be followed by prec '.' */
2897 after_type_declarator:
2898 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2899 { $$
= make_pointer_declarator
($2.t
, $3); }
2900 |
'&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2901 { $$
= make_reference_declarator
($2.t
, $3); }
2902 |
'*' after_type_declarator_intern %prec UNARY
2903 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2904 |
'&' after_type_declarator_intern %prec UNARY
2905 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2906 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2907 { tree arg
= make_pointer_declarator
($2, $3);
2908 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2910 | direct_after_type_declarator
2913 direct_after_type_declarator:
2914 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
2915 { $$
= make_call_declarator
($$
, $2, $3, $4); }
2916 | direct_after_type_declarator
'[' expr
']'
2917 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
2918 | direct_after_type_declarator
'[' ']'
2919 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
2920 |
'(' after_type_declarator_intern
')'
2922 | nested_name_specifier type_name %prec EMPTY
2923 { push_nested_class
($1, 3);
2924 $$
= build_nt
(SCOPE_REF
, $$
, $2);
2925 TREE_COMPLEXITY
($$
) = current_class_depth
; }
2926 | type_name %prec EMPTY
2930 type_name %prec EMPTY
2932 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
2934 $$
= lookup_name
($1, 1);
2935 maybe_note_name_used_in_class
($1, $$
);
2940 | global_scope type_name
2942 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
2943 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
2946 got_scope
= NULL_TREE
;
2953 | global_scope nested_type
2958 nested_name_specifier type_name %prec EMPTY
2959 { $$
= get_type_decl
($2); }
2962 /* A declarator allowed whether or not there has been
2963 an explicit typespec. These cannot redeclare a typedef-name. */
2965 notype_declarator_intern:
2967 | attributes notype_declarator
2969 /* Provide support for '(' attributes '*' declarator ')'
2971 $$
= tree_cons
($1, $2, NULL_TREE
);
2976 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2977 { $$
= make_pointer_declarator
($2.t
, $3); }
2978 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2979 { $$
= make_reference_declarator
($2.t
, $3); }
2980 |
'*' notype_declarator_intern %prec UNARY
2981 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2982 |
'&' notype_declarator_intern %prec UNARY
2983 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2984 | ptr_to_mem cv_qualifiers notype_declarator_intern
2985 { tree arg
= make_pointer_declarator
($2, $3);
2986 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2988 | direct_notype_declarator
2991 complex_notype_declarator:
2992 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2993 { $$
= make_pointer_declarator
($2.t
, $3); }
2994 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2995 { $$
= make_reference_declarator
($2.t
, $3); }
2996 |
'*' complex_notype_declarator %prec UNARY
2997 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2998 |
'&' complex_notype_declarator %prec UNARY
2999 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
3000 | ptr_to_mem cv_qualifiers notype_declarator_intern
3001 { tree arg
= make_pointer_declarator
($2, $3);
3002 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3004 | complex_direct_notype_declarator
3007 complex_direct_notype_declarator:
3008 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
3009 { $$
= make_call_declarator
($$
, $2, $3, $4); }
3010 |
'(' complex_notype_declarator
')'
3012 | direct_notype_declarator
'[' expr
']'
3013 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3014 | direct_notype_declarator
'[' ']'
3015 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
3016 | notype_qualified_id
3017 { enter_scope_of
($1); }
3018 | global_scope notype_qualified_id
3019 { enter_scope_of
($2); $$
= $2;}
3020 | global_scope notype_unqualified_id
3021 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $2);
3022 enter_scope_of
($$
);
3024 | nested_name_specifier notype_template_declarator
3025 { got_scope
= NULL_TREE
;
3026 $$
= build_nt
(SCOPE_REF
, $1, $2);
3027 enter_scope_of
($$
);
3032 nested_name_specifier unqualified_id
3033 { got_scope
= NULL_TREE
;
3034 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
3035 | nested_name_specifier object_template_id
3036 { got_scope
= NULL_TREE
;
3037 $$
= build_nt
(SCOPE_REF
, $1, $2); }
3040 notype_qualified_id:
3041 nested_name_specifier notype_unqualified_id
3042 { got_scope
= NULL_TREE
;
3043 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
3044 | nested_name_specifier object_template_id
3045 { got_scope
= NULL_TREE
;
3046 $$
= build_nt
(SCOPE_REF
, $1, $2); }
3051 | global_scope notype_qualified_id
3056 typespec
'(' nonnull_exprlist
')'
3057 { $$
= build_functional_cast
($1.t
, $3); }
3058 | typespec
'(' expr_or_declarator_intern
')'
3059 { $$
= reparse_decl_as_expr
($1.t
, $3); }
3060 | typespec fcast_or_absdcl %prec EMPTY
3061 { $$
= reparse_absdcl_as_expr
($1.t
, $2); }
3067 | template_type %prec EMPTY
3070 nested_name_specifier:
3071 nested_name_specifier_1
3072 | nested_name_specifier nested_name_specifier_1
3074 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
3076 = make_typename_type
($1, $3, tf_error
); }
3077 /* Error handling per Core 125. */
3078 | nested_name_specifier IDENTIFIER SCOPE
3080 = make_typename_type
($1, $2, tf_error
); }
3081 | nested_name_specifier PTYPENAME SCOPE
3083 = make_typename_type
($1, $2, tf_error
); }
3086 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3087 inline here?!? (jason) */
3088 nested_name_specifier_1:
3091 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3094 maybe_note_name_used_in_class
($1, $$
);
3097 complete_type
(TYPE_MAIN_VARIANT
(TREE_TYPE
($$
)));
3101 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3103 got_scope
= $$
= TREE_TYPE
($$
);
3107 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3111 | template_type SCOPE
3112 { got_scope
= $$
= complete_type
(TREE_TYPE
($1)); }
3117 | global_scope typename_sub0
3122 typename_sub1 identifier %prec EMPTY
3125 $$
= make_typename_type
($1, $2, tf_error
);
3126 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3127 error ("`%T' is not a class or namespace", $2);
3131 if
(TREE_CODE
($$
) == TYPE_DECL
)
3132 $$
= TREE_TYPE
($$
);
3135 | typename_sub1 template_type %prec EMPTY
3136 { $$
= TREE_TYPE
($2); }
3137 | typename_sub1 explicit_template_type %prec EMPTY
3138 { $$
= make_typename_type
($1, $2, tf_error
); }
3139 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
3140 { $$
= make_typename_type
($1, $3, tf_error
); }
3146 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3147 error ("`%T' is not a class or namespace", $1);
3148 else if
(TREE_CODE
($1) == TYPE_DECL
)
3149 $$
= TREE_TYPE
($1);
3151 | typename_sub1 typename_sub2
3154 $$
= make_typename_type
($1, $2, tf_error
);
3155 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3156 error ("`%T' is not a class or namespace", $2);
3160 if
(TREE_CODE
($$
) == TYPE_DECL
)
3161 $$
= TREE_TYPE
($$
);
3164 | typename_sub1 explicit_template_type SCOPE
3166 = make_typename_type
($1, $2, tf_error
); }
3167 | typename_sub1 TEMPLATE explicit_template_type SCOPE
3169 = make_typename_type
($1, $3, tf_error
); }
3172 /* This needs to return a TYPE_DECL for simple names so that we don't
3173 forget what name was used. */
3177 if
(TREE_CODE
($1) != TYPE_DECL
)
3180 /* Retrieve the type for the identifier, which might involve
3181 some computation. */
3182 got_scope
= complete_type
(TREE_TYPE
($$
));
3184 if
($$
== error_mark_node
)
3185 error ("`%T' is not a class or namespace", $1);
3189 if
(TREE_CODE
($1) != TYPE_DECL
)
3191 got_scope
= complete_type
(TREE_TYPE
($$
));
3193 | template_type SCOPE
3194 { got_scope
= $$
= complete_type
(TREE_TYPE
($$
)); }
3199 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3205 explicit_template_type:
3206 identifier
'<' template_arg_list_opt template_close_bracket
3207 { $$
= build_min_nt
(TEMPLATE_ID_EXPR
, $1, $3); }
3211 global_scope type_name
3213 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3214 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
3217 got_scope
= NULL_TREE
;
3220 | global_scope nested_type
3225 nested_name_specifier
'*'
3226 { got_scope
= NULL_TREE
; }
3227 | global_scope nested_name_specifier
'*'
3228 { $$
= $2; got_scope
= NULL_TREE
; }
3231 /* All uses of explicit global scope must go through this nonterminal so
3232 that got_scope will be set before yylex is called to get the next token. */
3235 { got_scope
= void_type_node
; }
3238 /* ISO new-declarator (5.3.4) */
3240 '*' cv_qualifiers new_declarator
3241 { $$
= make_pointer_declarator
($2, $3); }
3242 |
'*' cv_qualifiers %prec EMPTY
3243 { $$
= make_pointer_declarator
($2, NULL_TREE
); }
3244 |
'&' cv_qualifiers new_declarator %prec EMPTY
3245 { $$
= make_reference_declarator
($2, $3); }
3246 |
'&' cv_qualifiers %prec EMPTY
3247 { $$
= make_reference_declarator
($2, NULL_TREE
); }
3248 | ptr_to_mem cv_qualifiers %prec EMPTY
3249 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3250 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3252 | ptr_to_mem cv_qualifiers new_declarator
3253 { tree arg
= make_pointer_declarator
($2, $3);
3254 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3256 | direct_new_declarator %prec EMPTY
3259 /* ISO direct-new-declarator (5.3.4) */
3260 direct_new_declarator:
3262 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3263 | direct_new_declarator
'[' expr
']'
3264 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3271 /* Provide support for '(' attributes '*' declarator ')'
3273 $$
= tree_cons
($1, $2, NULL_TREE
);
3277 /* ISO abstract-declarator (8.1) */
3279 '*' nonempty_cv_qualifiers absdcl_intern
3280 { $$
= make_pointer_declarator
($2.t
, $3); }
3282 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
3283 |
'*' nonempty_cv_qualifiers %prec EMPTY
3284 { $$
= make_pointer_declarator
($2.t
, NULL_TREE
); }
3286 { $$
= make_pointer_declarator
(NULL_TREE
, NULL_TREE
); }
3287 |
'&' nonempty_cv_qualifiers absdcl_intern
3288 { $$
= make_reference_declarator
($2.t
, $3); }
3290 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
3291 |
'&' nonempty_cv_qualifiers %prec EMPTY
3292 { $$
= make_reference_declarator
($2.t
, NULL_TREE
); }
3294 { $$
= make_reference_declarator
(NULL_TREE
, NULL_TREE
); }
3295 | ptr_to_mem cv_qualifiers %prec EMPTY
3296 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3297 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3299 | ptr_to_mem cv_qualifiers absdcl_intern
3300 { tree arg
= make_pointer_declarator
($2, $3);
3301 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3303 | direct_abstract_declarator %prec EMPTY
3306 /* ISO direct-abstract-declarator (8.1) */
3307 direct_abstract_declarator:
3308 '(' absdcl_intern
')'
3310 /* `(typedef)1' is `int'. */
3311 | direct_abstract_declarator
'(' parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3312 { $$
= make_call_declarator
($$
, $3, $5, $6); }
3313 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec
'.'
3314 { $$
= make_call_declarator
($$
, empty_parms
(), $3, $4); }
3315 | direct_abstract_declarator
'[' expr
']' %prec
'.'
3316 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3317 | direct_abstract_declarator
'[' ']' %prec
'.'
3318 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
3319 |
'(' complex_parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3320 { $$
= make_call_declarator
(NULL_TREE
, $2, $4, $5); }
3321 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3322 { set_quals_and_spec
($$
, $2, $3); }
3323 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3324 { set_quals_and_spec
($$
, $2, $3); }
3325 |
'[' expr
']' %prec
'.'
3326 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3328 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, NULL_TREE
); }
3331 /* For C++, decls and stmts can be intermixed, so we don't need to
3332 have a special rule that won't start parsing the stmt section
3333 until we have a stmt that parses without errors. */
3346 /* Read zero or more forward-declarations for labels
3347 that nested functions can jump to. */
3352 pedwarn
("ISO C++ forbids label declarations"); }
3357 | label_decls label_decl
3361 LABEL identifiers_or_typenames
';'
3365 finish_label_decl
(TREE_VALUE
($2));
3366 $2 = TREE_CHAIN
($2);
3371 compstmt_or_stmtexpr:
3373 { $
<ttype
>$
= begin_compound_stmt
(0); }
3375 { STMT_LINENO
($
<ttype
>3) = $1;
3376 finish_compound_stmt
(0, $
<ttype
>3); }
3380 compstmt_or_stmtexpr
3381 { last_expr_type
= NULL_TREE
; }
3386 { $
<ttype
>$
= begin_if_stmt
();
3387 cond_stmt_keyword
= "if"; }
3389 { finish_if_stmt_cond
($3, $
<ttype
>2); }
3390 implicitly_scoped_stmt
3392 finish_then_clause
($
<ttype
>2); }
3395 implicitly_scoped_stmt:
3398 { $
<ttype
>$
= begin_compound_stmt
(0); }
3399 save_lineno simple_stmt
3400 { STMT_LINENO
($
<ttype
>1) = $2;
3401 if
($3) STMT_LINENO
($3) = $2;
3402 finish_compound_stmt
(0, $
<ttype
>1); }
3407 | save_lineno simple_stmt
3408 { if
($2) STMT_LINENO
($2) = $1; }
3416 { $$
= finish_expr_stmt
($1); }
3418 { begin_else_clause
(); }
3419 implicitly_scoped_stmt
3422 finish_else_clause
($1);
3425 | simple_if %prec IF
3427 finish_if_stmt
(); }
3430 $
<ttype
>$
= begin_while_stmt
();
3431 cond_stmt_keyword
= "while";
3434 { finish_while_stmt_cond
($3, $
<ttype
>2); }
3435 implicitly_scoped_stmt
3437 finish_while_stmt
($
<ttype
>2); }
3439 { $
<ttype
>$
= begin_do_stmt
(); }
3440 implicitly_scoped_stmt WHILE
3442 finish_do_body
($
<ttype
>2);
3443 cond_stmt_keyword
= "do";
3445 paren_expr_or_null
';'
3447 finish_do_stmt
($6, $
<ttype
>2); }
3449 { $
<ttype
>$
= begin_for_stmt
(); }
3450 '(' for.init.statement
3451 { finish_for_init_stmt
($
<ttype
>2); }
3453 { finish_for_cond
($6, $
<ttype
>2); }
3455 { finish_for_expr
($9, $
<ttype
>2); }
3456 implicitly_scoped_stmt
3458 finish_for_stmt
($
<ttype
>2); }
3460 { $
<ttype
>$
= begin_switch_stmt
(); }
3462 { finish_switch_cond
($4, $
<ttype
>2); }
3463 implicitly_scoped_stmt
3465 finish_switch_stmt
($
<ttype
>2); }
3466 | CASE expr_no_commas
':'
3467 { $
<ttype
>$
= finish_case_label
($2, NULL_TREE
); }
3470 | CASE expr_no_commas ELLIPSIS expr_no_commas
':'
3471 { $
<ttype
>$
= finish_case_label
($2, $4); }
3475 { $
<ttype
>$
= finish_case_label
(NULL_TREE
, NULL_TREE
); }
3479 { $$
= finish_break_stmt
(); }
3481 { $$
= finish_continue_stmt
(); }
3482 | RETURN_KEYWORD
';'
3483 { $$
= finish_return_stmt
(NULL_TREE
); }
3484 | RETURN_KEYWORD expr
';'
3485 { $$
= finish_return_stmt
($2); }
3486 | asm_keyword maybe_cv_qualifier
'(' string ')' ';'
3487 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, NULL_TREE
,
3489 ASM_INPUT_P
($$
) = 1; }
3490 /* This is the case with just output operands. */
3491 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
')' ';'
3492 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, NULL_TREE
); }
3493 /* This is the case with input operands as well. */
3494 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
':'
3495 asm_operands
')' ';'
3496 { $$
= finish_asm_stmt
($2, $4, $6, $8, NULL_TREE
); }
3497 | asm_keyword maybe_cv_qualifier
'(' string SCOPE asm_operands
')' ';'
3498 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, NULL_TREE
); }
3499 /* This is the case with clobbered registers as well. */
3500 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
':'
3501 asm_operands
':' asm_clobbers
')' ';'
3502 { $$
= finish_asm_stmt
($2, $4, $6, $8, $10); }
3503 | asm_keyword maybe_cv_qualifier
'(' string SCOPE asm_operands
':'
3504 asm_clobbers
')' ';'
3505 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, $8); }
3506 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands SCOPE
3507 asm_clobbers
')' ';'
3508 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, $8); }
3512 pedwarn
("ISO C++ forbids computed gotos");
3513 $$
= finish_goto_stmt
($3);
3515 | GOTO identifier
';'
3516 { $$
= finish_goto_stmt
($2); }
3520 { error ("label must be followed by statement");
3530 | namespace_using_decl
3531 { do_local_using_decl
($1);
3539 { $
<ttype
>$
= begin_function_try_block
(); }
3541 { finish_function_try_block
($
<ttype
>2); }
3543 { finish_function_handler_sequence
($
<ttype
>2); }
3548 { $
<ttype
>$
= begin_try_block
(); }
3550 { finish_try_block
($
<ttype
>2); }
3552 { finish_handler_sequence
($
<ttype
>2); }
3557 | handler_seq handler
3559 { /* Generate a fake handler block to avoid later aborts. */
3560 tree fake_handler
= begin_handler
();
3561 finish_handler_parms
(NULL_TREE
, fake_handler
);
3562 finish_handler
(fake_handler
);
3563 $
<ttype
>$
= fake_handler
;
3565 error ("must have at least one catch per try block");
3571 { $
<ttype
>$
= begin_handler
(); }
3573 { finish_handler_parms
($3, $
<ttype
>2); }
3575 { finish_handler
($
<ttype
>2); }
3579 typed_typespecs %prec EMPTY
3580 | nonempty_cv_qualifiers %prec EMPTY
3586 /* This doesn't allow reference parameters, the below does.
3587 | '(' type_specifier_seq absdcl ')'
3588 { check_for_new_type ("inside exception declarations", $2);
3589 expand_start_catch_block ($2.t, $3); }
3590 | '(' type_specifier_seq ')'
3591 { check_for_new_type ("inside exception declarations", $2);
3592 expand_start_catch_block ($2.t, NULL_TREE); }
3593 | '(' type_specifier_seq notype_declarator ')'
3594 { check_for_new_type ("inside exception declarations", $2);
3595 expand_start_catch_block ($2.t, $3); }
3596 | '(' typed_typespecs after_type_declarator ')'
3597 { check_for_new_type ("inside exception declarations", $2);
3598 expand_start_catch_block ($2.t, $3); }
3599 This allows reference parameters... */
3602 check_for_new_type
("inside exception declarations", $2);
3603 $$
= start_handler_parms
(TREE_PURPOSE
($2.t
),
3610 { finish_label_stmt
($1); }
3612 { finish_label_stmt
($1); }
3614 { finish_label_stmt
($1); }
3616 { finish_label_stmt
($1); }
3621 { finish_expr_stmt
($1); }
3625 pedwarn
("ISO C++ forbids compound statements inside for initializations");
3629 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3645 /* These are the operands other than the first string and colon
3646 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3650 | nonnull_asm_operands
3653 nonnull_asm_operands:
3655 | nonnull_asm_operands
',' asm_operand
3656 { $$
= chainon
($$
, $3); }
3661 { $$
= build_tree_list
(build_tree_list
(NULL_TREE
, $1), $3); }
3662 |
'[' identifier
']' STRING
'(' expr
')'
3663 { $$
= build_tree_list
(build_tree_list
($2, $4), $6); }
3668 { $$
= tree_cons
(NULL_TREE
, combine_strings
($1), NULL_TREE
);}
3669 | asm_clobbers
',' string
3670 { $$
= tree_cons
(NULL_TREE
, combine_strings
($3), $1); }
3673 /* This is what appears inside the parens in a function declarator.
3674 Its value is represented in the format that grokdeclarator expects.
3676 In C++, declaring a function with no parameters
3677 means that that function takes *no* parameters. */
3686 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
, $1.t
), 0);
3687 check_for_new_type
("inside parameter list", $1); }
3690 /* This nonterminal does not include the common sequence '(' type_id ')',
3691 as it is ambiguous and must be disambiguated elsewhere. */
3694 { $$
= finish_parmlist
($$
, 0); }
3695 | parms_comma ELLIPSIS
3696 { $$
= finish_parmlist
($1, 1); }
3697 /* C++ allows an ellipsis without a separating ',' */
3699 { $$
= finish_parmlist
($1, 1); }
3701 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3704 { $$
= finish_parmlist
(NULL_TREE
, 1); }
3707 /* This helps us recover from really nasty
3708 parse errors, for example, a missing right
3710 yyerror ("possibly missing ')'");
3711 $$
= finish_parmlist
($1, 0);
3717 /* This helps us recover from really nasty
3718 parse errors, for example, a missing right
3720 yyerror ("possibly missing ')'");
3721 $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3728 /* A default argument to a */
3731 { maybe_snarf_defarg
(); }
3741 /* A nonempty list of parameter declarations or type names. */
3744 { check_for_new_type
("in a parameter list", $1);
3745 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3747 { check_for_new_type
("in a parameter list", $1);
3748 $$
= build_tree_list
($2, $1.t
); }
3749 | parms_comma full_parm
3750 { check_for_new_type
("in a parameter list", $2);
3751 $$
= chainon
($$
, $2.t
); }
3752 | parms_comma bad_parm
3753 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $2)); }
3754 | parms_comma bad_parm
'=' init
3755 { $$
= chainon
($$
, build_tree_list
($4, $2)); }
3761 { check_for_new_type
("in a parameter list", $1);
3762 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3765 /* A single parameter declaration or parameter type name,
3766 as found in a parmlist. */
3768 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3769 TYPESPEC IDENTIFIER. */
3770 typed_declspecs1 declarator
3771 { $$.new_type_flag
= $1.new_type_flag
;
3772 $$.t
= build_tree_list
($1.t
, $2); }
3773 | typed_typespecs declarator
3774 { $$.t
= build_tree_list
($1.t
, $2);
3775 $$.new_type_flag
= $1.new_type_flag
; }
3776 | typespec declarator
3777 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
3779 $$.new_type_flag
= $1.new_type_flag
; }
3780 | typed_declspecs1 absdcl
3781 { $$.t
= build_tree_list
($1.t
, $2);
3782 $$.new_type_flag
= $1.new_type_flag
; }
3783 | typed_declspecs1 %prec EMPTY
3784 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
3785 $$.new_type_flag
= $1.new_type_flag
; }
3786 | declmods notype_declarator
3787 { $$.t
= build_tree_list
($1.t
, $2);
3788 $$.new_type_flag
= 0; }
3793 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
3794 $$.new_type_flag
= $1.new_type_flag
; }
3796 { $$.t
= build_tree_list
($2, $1.t
);
3797 $$.new_type_flag
= $1.new_type_flag
; }
3806 /* empty */ %prec EMPTY
3807 { see_typename
(); }
3811 /* empty */ %prec EMPTY
3813 error ("type specifier omitted for parameter");
3814 $$
= build_tree_list
(integer_type_node
, NULL_TREE
);
3818 if
(TREE_CODE
($$
) == SCOPE_REF
)
3820 if
(TREE_CODE
(TREE_OPERAND
($$
, 0)) == TEMPLATE_TYPE_PARM
3821 || TREE_CODE
(TREE_OPERAND
($$
, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM
)
3822 error ("`%E' is not a type, use `typename %E' to make it one", $$
);
3824 error ("no type `%D' in `%T'", TREE_OPERAND
($$
, 1), TREE_OPERAND
($$
, 0));
3827 error ("type specifier omitted for parameter `%E'", $$
);
3828 $$
= build_tree_list
(integer_type_node
, $$
);
3833 IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore
';'
3835 error("'%D' is used as a type, but is not defined as a type.", $1);
3836 $3 = error_mark_node
;
3840 template_arg_list_ignore:
3841 '<' template_arg_list_opt template_close_bracket
3847 '(' nonnull_exprlist
')'
3852 exception_specification_opt:
3853 /* empty */ %prec EMPTY
3855 | THROW
'(' ansi_raise_identifiers
')' %prec EMPTY
3857 | THROW LEFT_RIGHT %prec EMPTY
3858 { $$
= empty_except_spec
; }
3861 ansi_raise_identifier:
3864 check_for_new_type
("exception specifier", $1);
3865 $$
= groktypename
($1.t
);
3868 { $$
= error_mark_node
; }
3871 ansi_raise_identifiers:
3872 ansi_raise_identifier
3873 { $$
= add_exception_specifier
(NULL_TREE
, $1, 1); }
3874 | ansi_raise_identifiers
',' ansi_raise_identifier
3875 { $$
= add_exception_specifier
($1, $3, 1); }
3878 conversion_declarator:
3879 /* empty */ %prec EMPTY
3881 |
'*' cv_qualifiers conversion_declarator
3882 { $$
= make_pointer_declarator
($2, $3); }
3883 |
'&' cv_qualifiers conversion_declarator
3884 { $$
= make_reference_declarator
($2, $3); }
3885 | ptr_to_mem cv_qualifiers conversion_declarator
3886 { tree arg
= make_pointer_declarator
($2, $3);
3887 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3894 saved_scopes
= tree_cons
(got_scope
, got_object
, saved_scopes
);
3895 TREE_LANG_FLAG_0
(saved_scopes
) = looking_for_typename
;
3896 /* We look for conversion-type-id's in both the class and current
3897 scopes, just as for ID in 'ptr->ID::'. */
3898 looking_for_typename
= 1;
3899 got_object
= got_scope
;
3900 got_scope
= NULL_TREE
;
3905 { got_scope
= TREE_PURPOSE
(saved_scopes
);
3906 got_object
= TREE_VALUE
(saved_scopes
);
3907 looking_for_typename
= TREE_LANG_FLAG_0
(saved_scopes
);
3908 saved_scopes
= TREE_CHAIN
(saved_scopes
);
3913 operator
'*' unoperator
3914 { $$
= frob_opname
(ansi_opname
(MULT_EXPR
)); }
3915 | operator
'/' unoperator
3916 { $$
= frob_opname
(ansi_opname
(TRUNC_DIV_EXPR
)); }
3917 | operator
'%' unoperator
3918 { $$
= frob_opname
(ansi_opname
(TRUNC_MOD_EXPR
)); }
3919 | operator
'+' unoperator
3920 { $$
= frob_opname
(ansi_opname
(PLUS_EXPR
)); }
3921 | operator
'-' unoperator
3922 { $$
= frob_opname
(ansi_opname
(MINUS_EXPR
)); }
3923 | operator
'&' unoperator
3924 { $$
= frob_opname
(ansi_opname
(BIT_AND_EXPR
)); }
3925 | operator
'|' unoperator
3926 { $$
= frob_opname
(ansi_opname
(BIT_IOR_EXPR
)); }
3927 | operator
'^' unoperator
3928 { $$
= frob_opname
(ansi_opname
(BIT_XOR_EXPR
)); }
3929 | operator
'~' unoperator
3930 { $$
= frob_opname
(ansi_opname
(BIT_NOT_EXPR
)); }
3931 | operator
',' unoperator
3932 { $$
= frob_opname
(ansi_opname
(COMPOUND_EXPR
)); }
3933 | operator ARITHCOMPARE unoperator
3934 { $$
= frob_opname
(ansi_opname
($2)); }
3935 | operator
'<' unoperator
3936 { $$
= frob_opname
(ansi_opname
(LT_EXPR
)); }
3937 | operator
'>' unoperator
3938 { $$
= frob_opname
(ansi_opname
(GT_EXPR
)); }
3939 | operator EQCOMPARE unoperator
3940 { $$
= frob_opname
(ansi_opname
($2)); }
3941 | operator ASSIGN unoperator
3942 { $$
= frob_opname
(ansi_assopname
($2)); }
3943 | operator
'=' unoperator
3944 { $$
= frob_opname
(ansi_assopname
(NOP_EXPR
)); }
3945 | operator LSHIFT unoperator
3946 { $$
= frob_opname
(ansi_opname
($2)); }
3947 | operator RSHIFT unoperator
3948 { $$
= frob_opname
(ansi_opname
($2)); }
3949 | operator PLUSPLUS unoperator
3950 { $$
= frob_opname
(ansi_opname
(POSTINCREMENT_EXPR
)); }
3951 | operator MINUSMINUS unoperator
3952 { $$
= frob_opname
(ansi_opname
(PREDECREMENT_EXPR
)); }
3953 | operator ANDAND unoperator
3954 { $$
= frob_opname
(ansi_opname
(TRUTH_ANDIF_EXPR
)); }
3955 | operator OROR unoperator
3956 { $$
= frob_opname
(ansi_opname
(TRUTH_ORIF_EXPR
)); }
3957 | operator
'!' unoperator
3958 { $$
= frob_opname
(ansi_opname
(TRUTH_NOT_EXPR
)); }
3959 | operator
'?' ':' unoperator
3960 { $$
= frob_opname
(ansi_opname
(COND_EXPR
)); }
3961 | operator MIN_MAX unoperator
3962 { $$
= frob_opname
(ansi_opname
($2)); }
3963 | operator POINTSAT unoperator %prec EMPTY
3964 { $$
= frob_opname
(ansi_opname
(COMPONENT_REF
)); }
3965 | operator POINTSAT_STAR unoperator %prec EMPTY
3966 { $$
= frob_opname
(ansi_opname
(MEMBER_REF
)); }
3967 | operator LEFT_RIGHT unoperator
3968 { $$
= frob_opname
(ansi_opname
(CALL_EXPR
)); }
3969 | operator
'[' ']' unoperator
3970 { $$
= frob_opname
(ansi_opname
(ARRAY_REF
)); }
3971 | operator NEW unoperator %prec EMPTY
3972 { $$
= frob_opname
(ansi_opname
(NEW_EXPR
)); }
3973 | operator DELETE unoperator %prec EMPTY
3974 { $$
= frob_opname
(ansi_opname
(DELETE_EXPR
)); }
3975 | operator NEW
'[' ']' unoperator
3976 { $$
= frob_opname
(ansi_opname
(VEC_NEW_EXPR
)); }
3977 | operator DELETE
'[' ']' unoperator
3978 { $$
= frob_opname
(ansi_opname
(VEC_DELETE_EXPR
)); }
3979 | operator type_specifier_seq conversion_declarator unoperator
3980 { $$
= frob_opname
(grokoptypename
($2.t
, $3)); }
3981 | operator
error unoperator
3982 { $$
= frob_opname
(ansi_opname
(ERROR_MARK
)); }
3985 /* The forced readahead in here is because we might be at the end of a
3986 line, and lineno won't be bumped until yylex absorbs the first token
3987 on the next line. */
3989 { if
(yychar == YYEMPTY
)
3997 debug_yytranslate
(value
)
4000 return yytname
[YYTRANSLATE
(value
)];