1 /* YACC parser for C++ syntax.
2 Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001 Free Software Foundation, Inc.
4 Hacked by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
24 /* This grammar is based on the GNU CC grammar. */
26 /* Note: Bison automatically applies a default action of "$$ = $1" for
27 all derivations; this is applied before the explicit action, if one
28 is given. Keep this in mind when reading the actions. */
31 /* Cause the `yydebug' variable to be defined. */
48 extern
struct obstack permanent_obstack
;
50 /* Like YYERROR but do call yyerror. */
51 #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
53 #define OP0(NODE) (TREE_OPERAND (NODE, 0))
54 #define OP1(NODE) (TREE_OPERAND (NODE, 1))
56 /* Contains the statement keyword (if/while/do) to include in an
57 error message if the user supplies an empty conditional expression. */
58 static const char *cond_stmt_keyword
;
60 /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
64 /* List of types and structure classes of the current declaration. */
65 static tree current_declspecs
;
67 /* List of prefix attributes in effect.
68 Prefix attributes are parsed by the reserved_declspecs and declmods
69 rules. They create a list that contains *both* declspecs and attrs. */
70 /* ??? It is not clear yet that all cases where an attribute can now appear in
71 a declspec list have been updated. */
72 static tree prefix_attributes
;
74 /* When defining an enumeration, this is the type of the enumeration. */
75 static tree current_enum_type
;
77 /* When parsing a conversion operator name, this is the scope of the
79 static tree saved_scopes
;
81 static tree empty_parms PARAMS
((void));
82 static tree parse_decl0 PARAMS
((tree
, tree
, tree
, tree
, int));
83 static tree parse_decl PARAMS
((tree
, tree
, int));
84 static void parse_end_decl PARAMS
((tree
, tree
, tree
));
85 static tree parse_field0 PARAMS
((tree
, tree
, tree
, tree
, tree
, tree
));
86 static tree parse_field PARAMS
((tree
, tree
, tree
, tree
));
87 static tree parse_bitfield0 PARAMS
((tree
, tree
, tree
, tree
, tree
));
88 static tree parse_bitfield PARAMS
((tree
, tree
, tree
));
89 static tree parse_method PARAMS
((tree
, tree
, tree
));
90 static void frob_specs PARAMS
((tree
, tree
));
92 /* Cons up an empty parameter list. */
98 #ifndef NO_IMPLICIT_EXTERN_C
99 if
(in_system_header
&& current_class_type
== NULL
100 && current_lang_name
== lang_name_c
)
104 parms
= void_list_node
;
108 /* Record the decl-specifiers, attributes and type lookups from the
109 decl-specifier-seq in a declaration. */
112 frob_specs
(specs_attrs
, lookups
)
113 tree specs_attrs
, lookups
;
115 save_type_access_control
(lookups
);
116 split_specs_attrs
(specs_attrs
, ¤t_declspecs
, &prefix_attributes
);
117 if
(current_declspecs
118 && TREE_CODE
(current_declspecs
) != TREE_LIST
)
119 current_declspecs
= build_tree_list
(NULL_TREE
, current_declspecs
);
120 if
(have_extern_spec
&& !used_extern_spec
)
122 /* We have to indicate that there is an "extern", but that it
123 was part of a language specifier. For instance,
125 extern "C" typedef int (*Ptr) ();
128 current_declspecs
= tree_cons
(error_mark_node
,
129 get_identifier
("extern"),
131 used_extern_spec
= 1;
136 parse_decl
(declarator
, attributes
, initialized
)
137 tree declarator
, attributes
;
140 return start_decl
(declarator
, current_declspecs
, initialized
,
141 attributes
, prefix_attributes
);
145 parse_decl0
(declarator
, specs_attrs
, lookups
, attributes
, initialized
)
146 tree declarator
, specs_attrs
, lookups
, attributes
;
149 frob_specs
(specs_attrs
, lookups
);
150 return parse_decl
(declarator
, attributes
, initialized
);
154 parse_end_decl
(decl
, init
, asmspec
)
155 tree decl
, init
, asmspec
;
157 /* If decl is NULL_TREE, then this was a variable declaration using
158 () syntax for the initializer, so we handled it in grokdeclarator. */
160 decl_type_access_control
(decl
);
161 cp_finish_decl
(decl
, init
, asmspec
, init ? LOOKUP_ONLYCONVERTING
: 0);
165 parse_field
(declarator
, attributes
, asmspec
, init
)
166 tree declarator
, attributes
, asmspec
, init
;
168 tree d
= grokfield
(declarator
, current_declspecs
, init
, asmspec
,
169 chainon
(attributes
, prefix_attributes
));
170 decl_type_access_control
(d
);
175 parse_field0
(declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
)
176 tree declarator
, specs_attrs
, lookups
, attributes
, asmspec
, init
;
178 frob_specs
(specs_attrs
, lookups
);
179 return parse_field
(declarator
, attributes
, asmspec
, init
);
183 parse_bitfield
(declarator
, attributes
, width
)
184 tree declarator
, attributes
, width
;
186 tree d
= grokbitfield
(declarator
, current_declspecs
, width
);
187 cplus_decl_attributes
(&d
, chainon
(attributes
, prefix_attributes
), 0);
188 decl_type_access_control
(d
);
193 parse_bitfield0
(declarator
, specs_attrs
, lookups
, attributes
, width
)
194 tree declarator
, specs_attrs
, lookups
, attributes
, width
;
196 frob_specs
(specs_attrs
, lookups
);
197 return parse_bitfield
(declarator
, attributes
, width
);
201 parse_method
(declarator
, specs_attrs
, lookups
)
202 tree declarator
, specs_attrs
, lookups
;
205 frob_specs
(specs_attrs
, lookups
);
206 d
= start_method
(current_declspecs
, declarator
, prefix_attributes
);
207 decl_type_access_control
(d
);
214 ggc_add_tree_root
(¤t_declspecs
, 1);
215 ggc_add_tree_root
(&prefix_attributes
, 1);
216 ggc_add_tree_root
(¤t_enum_type
, 1);
217 ggc_add_tree_root
(&saved_scopes
, 1);
220 /* Rename the "yyparse" function so that we can override it elsewhere. */
221 #define yyparse yyparse_1
231 flagged_type_tree ftype
;
232 struct unparsed_text
*pi
;
235 /* All identifiers that are not reserved words
236 and are not declared typedefs in the current block */
239 /* All identifiers that are declared typedefs in the current block.
240 In some contexts, they are treated just like IDENTIFIER,
241 but they can also serve as typespecs in declarations. */
245 /* A template function. */
248 /* Reserved words that specify storage class.
249 yylval contains an IDENTIFIER_NODE which indicates which one. */
252 /* Reserved words that specify type.
253 yylval contains an IDENTIFIER_NODE which indicates which one. */
256 /* Reserved words that qualify type: "const" or "volatile".
257 yylval contains an IDENTIFIER_NODE which indicates which one. */
260 /* Character or numeric constants.
261 yylval is the node for the constant. */
264 /* __func__, __FUNCTION__ or __PRETTY_FUNCTION__.
265 yylval contains an IDENTIFIER_NODE which indicates which one. */
268 /* String constants in raw form.
269 yylval is a STRING_CST node. */
272 /* "...", used for functions with variable arglists. */
275 /* the reserved words */
276 /* SCO include files test "ASM", so use something else. */
277 %token SIZEOF ENUM
/* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
278 %token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF
280 %token ATTRIBUTE EXTENSION LABEL
281 %token REALPART IMAGPART VA_ARG
283 /* the reserved words... C++ extensions */
285 %token
<ttype
> VISSPEC
286 %token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE
287 %token NAMESPACE TYPENAME_KEYWORD USING
288 %token LEFT_RIGHT TEMPLATE
289 %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
292 /* Define the operator tokens and their precedences.
293 The value is an integer because, if used, it is the tree code
294 to use in the expression made from the operator. */
296 %left EMPTY
/* used to resolve s/r with epsilon */
300 /* Add precedence rules to solve dangling else s/r conflict */
304 %left IDENTIFIER PFUNCNAME TYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
310 %right
<code
> ASSIGN
'='
318 %left
<code
> EQCOMPARE
319 %left
<code
> ARITHCOMPARE
'<' '>'
320 %left
<code
> LSHIFT RSHIFT
322 %left
<code
> '*' '/' '%'
323 %left
<code
> POINTSAT_STAR DOT_STAR
324 %right
<code
> UNARY PLUSPLUS MINUSMINUS
'~'
326 %left
<ttype
> LEFT_RIGHT
327 %left
<code
> POINTSAT
'.' '(' '['
329 %right SCOPE
/* C++ extension */
330 %nonassoc NEW DELETE TRY CATCH
334 %type
<ttype
> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
335 %type
<ttype
> PFUNCNAME maybe_identifier
336 %type
<ttype
> paren_expr_or_null nontrivial_exprlist SELFNAME
337 %type
<ttype
> expr_no_commas expr_no_comma_rangle
338 %type
<ttype
> cast_expr unary_expr primary
string STRING
339 %type
<ttype
> reserved_declspecs boolean.literal
340 %type
<ttype
> reserved_typespecquals
341 %type
<ttype
> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier
342 %type
<ttype
> init initlist maybeasm maybe_init defarg defarg1
343 %type
<ttype
> asm_operands nonnull_asm_operands asm_operand asm_clobbers
344 %type
<ttype
> maybe_attribute attributes attribute attribute_list attrib
345 %type
<ttype
> any_word
347 %type
<itype
> save_lineno
348 %type
<ttype
> simple_stmt simple_if
350 %type
<ttype
> declarator notype_declarator after_type_declarator
351 %type
<ttype
> notype_declarator_intern absdcl_intern
352 %type
<ttype
> after_type_declarator_intern
353 %type
<ttype
> direct_notype_declarator direct_after_type_declarator
354 %type
<itype
> components notype_components
355 %type
<ttype
> component_decl component_decl_1
356 %type
<ttype
> component_declarator component_declarator0
357 %type
<ttype
> notype_component_declarator notype_component_declarator0
358 %type
<ttype
> after_type_component_declarator after_type_component_declarator0
359 %type
<ttype
> absdcl cv_qualifiers
360 %type
<ttype
> direct_abstract_declarator conversion_declarator
361 %type
<ttype
> new_declarator direct_new_declarator
362 %type
<ttype
> xexpr parmlist parms bad_parm
363 %type
<ttype
> identifiers_or_typenames
364 %type
<ttype
> fcast_or_absdcl regcast_or_absdcl
365 %type
<ttype
> expr_or_declarator expr_or_declarator_intern
366 %type
<ttype
> complex_notype_declarator
367 %type
<ttype
> notype_unqualified_id unqualified_id qualified_id
368 %type
<ttype
> template_id do_id object_template_id notype_template_declarator
369 %type
<ttype
> overqualified_id notype_qualified_id any_id
370 %type
<ttype
> complex_direct_notype_declarator functional_cast
371 %type
<ttype
> complex_parmlist parms_comma
372 %type
<ttype
> namespace_qualifier namespace_using_decl
374 %type
<ftype
> type_id new_type_id typed_typespecs typespec typed_declspecs
375 %type
<ftype
> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers
376 %type
<ftype
> structsp typespecqual_reserved parm named_parm full_parm
377 %type
<ftype
> declmods
379 %type
<itype
> extension
382 %token
<ttype
> PTYPENAME
383 %token
<ttype
> EXTERN_LANG_STRING ALL
384 %token
<ttype
> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER
385 %token
<pi
> PRE_PARSED_FUNCTION_DECL
386 %type
<ttype
> component_constructor_declarator
387 %type
<ttype
> fn.def2 return_id constructor_declarator
388 %type
<itype
> ctor_initializer_opt function_try_block
389 %type
<ttype
> named_class_head_sans_basetype
390 %type
<ftype
> class_head named_class_head
391 %type
<ftype
> named_complex_class_head_sans_basetype
392 %type
<ttype
> unnamed_class_head
393 %type
<ttype
> base_class_list
394 %type
<ttype
> base_class_access_list
395 %type
<ttype
> base_class maybe_base_class_list base_class
.1
396 %type
<ttype
> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
397 %type
<ttype
> operator_name
398 %type
<ttype
> object aggr
399 %type
<itype
> new delete
400 /* %type <ttype> primary_no_id */
401 %type
<ttype
> maybe_parmlist
402 %type
<ttype
> member_init
403 %type
<ftype
> member_init_list
404 %type
<ttype
> template_parm_header template_spec_header template_header
405 %type
<ttype
> template_parm_list template_parm
406 %type
<ttype
> template_type_parm template_template_parm
407 %type
<code
> template_close_bracket
408 %type
<ttype
> apparent_template_type
409 %type
<ttype
> template_type template_arg_list template_arg_list_opt
410 %type
<ttype
> template_arg
411 %type
<ttype
> condition xcond paren_cond_or_null
412 %type
<ttype
> type_name nested_name_specifier nested_type ptr_to_mem
413 %type
<ttype
> complete_type_name notype_identifier nonnested_type
414 %type
<ttype
> complex_type_name nested_name_specifier_1
415 %type
<ttype
> new_initializer new_placement
416 %type
<ttype
> using_decl
417 %type
<ttype
> typename_sub typename_sub0 typename_sub1 typename_sub2
418 %type
<ttype
> explicit_template_type
419 /* in order to recognize aggr tags as defining and thus shadowing. */
420 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
421 %type
<ttype
> named_class_head_sans_basetype_defn
422 %type
<ttype
> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
423 %type
<ttype
> handler_args
424 %type
<ttype
> self_template_type .finish_template_type
429 /* Used in lex.c for parsing pragmas. */
432 /* lex.c and pt.c depend on this being the last token. Define
433 any new tokens before this one! */
434 %token END_OF_SAVED_INPUT
437 /* Tell yyparse how to print a token's value, if yydebug is set. */
438 #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
439 extern
void yyprint PARAMS
((FILE *, int, YYSTYPE));
445 { finish_translation_unit
(); }
447 { finish_translation_unit
(); }
450 /* the reason for the strange actions in this rule
451 is so that notype_initdecls when reached via datadef
452 can find a valid list of type and sc specs in $0. */
455 { $
<ttype
>$
= NULL_TREE
; }
457 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
458 | extdefs lang_extdef
459 { $
<ttype
>$
= NULL_TREE
; ggc_collect
(); }
468 { have_extern_spec
= 1;
469 used_extern_spec
= 0;
470 $
<ttype
>$
= NULL_TREE
; }
473 { have_extern_spec
= 0; }
487 { if
(pending_lang_change
) do_pending_lang_change
();
488 type_lookups
= NULL_TREE
; }
490 { if
(! toplevel_bindings_p
())
495 fndef eat_saved_input
496 { do_pending_inlines
(); }
498 { do_pending_inlines
(); }
501 { cp_warning
("keyword `export' not implemented, and will be ignored"); }
503 { do_pending_inlines
(); }
505 { do_pending_inlines
(); }
506 | asm_keyword
'(' string ')' ';'
507 { if
(TREE_CHAIN
($3)) $3 = combine_strings
($3);
509 | extern_lang_string
'{' extdefs_opt
'}'
510 { pop_lang_context
(); }
511 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
512 { do_pending_inlines
(); pop_lang_context
(); }
513 | extern_lang_string .hush_warning datadef .warning_ok
514 { do_pending_inlines
(); pop_lang_context
(); }
515 | NAMESPACE identifier
'{'
516 { push_namespace
($2); }
518 { pop_namespace
(); }
520 { push_namespace
(NULL_TREE
); }
522 { pop_namespace
(); }
525 { do_toplevel_using_decl
($1); }
532 NAMESPACE identifier
'='
533 { begin_only_namespace_names
(); }
536 end_only_namespace_names
();
539 do_namespace_alias
($2, $5);
546 | USING global_scope qualified_id
548 | USING global_scope unqualified_id
552 namespace_using_decl:
553 USING namespace_qualifier identifier
554 { $$
= build_nt
(SCOPE_REF
, $2, $3); }
555 | USING global_scope identifier
556 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $3); }
557 | USING global_scope namespace_qualifier identifier
558 { $$
= build_nt
(SCOPE_REF
, $3, $4); }
563 { begin_only_namespace_names
(); }
566 end_only_namespace_names
();
567 /* If no declaration was found, the using-directive is
568 invalid. Since that was not reported, we need the
569 identifier for the error message. */
570 if
(TREE_CODE
($4) == IDENTIFIER_NODE
&& lastiddecl
)
572 do_using_directive
($4);
579 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
583 | namespace_qualifier NSNAME SCOPE
586 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
594 | global_scope qualified_id
596 | global_scope unqualified_id
602 { push_lang_context
($1); }
603 | extern_lang_string EXTERN_LANG_STRING
604 { if
(current_lang_name
!= $2)
605 cp_error
("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name
);
606 pop_lang_context
(); push_lang_context
($2); }
609 template_parm_header:
611 { begin_template_parm_list
(); }
612 template_parm_list
'>'
613 { $$
= end_template_parm_list
($4); }
616 template_spec_header:
618 { begin_specialization
();
624 | template_spec_header
629 { $$
= process_template_parm
(NULL_TREE
, $1); }
630 | template_parm_list
',' template_parm
631 { $$
= process_template_parm
($1, $3); }
641 aggr maybe_identifier
642 { $$
= finish_template_type_parm
($1, $2); }
643 | TYPENAME_KEYWORD maybe_identifier
644 { $$
= finish_template_type_parm
(class_type_node
, $2); }
647 template_template_parm:
648 template_parm_header aggr maybe_identifier
649 { $$
= finish_template_template_parm
($2, $3); }
653 /* The following rules introduce a new reduce/reduce
654 conflict on the ',' and '>' input tokens: they are valid
655 prefixes for a `structsp', which means they could match a
656 nameless parameter. See 14.6, paragraph 3.
657 By putting them before the `parm' rule, we get
658 their match before considering them nameless parameter
661 { $$
= build_tree_list
(NULL_TREE
, $1); }
662 | template_type_parm
'=' type_id
663 { $$
= build_tree_list
(groktypename
($3.t
), $1); }
665 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
666 | parm
'=' expr_no_comma_rangle
667 { $$
= build_tree_list
($3, $1.t
); }
668 | template_template_parm
669 { $$
= build_tree_list
(NULL_TREE
, $1); }
670 | template_template_parm
'=' template_arg
672 if
(TREE_CODE
($3) != TEMPLATE_DECL
673 && TREE_CODE
($3) != TEMPLATE_TEMPLATE_PARM
674 && TREE_CODE
($3) != TYPE_DECL
675 && TREE_CODE
($3) != UNBOUND_CLASS_TEMPLATE
)
677 error ("invalid default template argument");
678 $3 = error_mark_node
;
680 $$
= build_tree_list
($3, $1);
685 template_header template_extdef
686 { finish_template_decl
($1); }
687 | template_header
error %prec EMPTY
688 { finish_template_decl
($1); }
692 fndef eat_saved_input
693 { do_pending_inlines
(); }
695 { do_pending_inlines
(); }
697 { do_pending_inlines
(); }
698 | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
699 { do_pending_inlines
();
700 pop_lang_context
(); }
701 | extern_lang_string .hush_warning template_datadef .warning_ok
702 { do_pending_inlines
();
703 pop_lang_context
(); }
704 | extension template_extdef
710 | declmods notype_initdecls
';'
712 | typed_declspecs initdecls
';'
713 { note_list_got_semicolon
($1.t
); }
716 if
($1.t
!= error_mark_node
)
718 maybe_process_partial_specialization
($1.t
);
719 note_got_semicolon
($1.t
);
726 | declmods notype_initdecls
';'
728 | typed_declspecs initdecls
';'
729 { note_list_got_semicolon
($1.t
); }
731 { pedwarn
("empty declaration"); }
732 | explicit_instantiation
';'
733 | typed_declspecs
';'
736 split_specs_attrs
($1.t
, &t
, &attrs
);
738 note_list_got_semicolon
($1.t
);
742 |
error END_OF_SAVED_INPUT
748 ctor_initializer_opt:
767 fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
768 { expand_body
(finish_function
((int)$3)); }
769 | fn.def1 maybe_return_init function_try_block
770 { expand_body
(finish_function
((int)$3)); }
771 | fn.def1 maybe_return_init
error
775 constructor_declarator:
776 nested_name_specifier SELFNAME
'('
777 { $$
= begin_constructor_declarator
($1, $2); }
778 parmlist
')' cv_qualifiers exception_specification_opt
779 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
780 | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
781 { $$
= begin_constructor_declarator
($1, $2);
782 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
784 | global_scope nested_name_specifier SELFNAME
'('
785 { $$
= begin_constructor_declarator
($2, $3); }
786 parmlist
')' cv_qualifiers exception_specification_opt
787 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
788 | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
789 { $$
= begin_constructor_declarator
($2, $3);
790 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
792 | nested_name_specifier self_template_type
'('
793 { $$
= begin_constructor_declarator
($1, $2); }
794 parmlist
')' cv_qualifiers exception_specification_opt
795 { $$
= make_call_declarator
($
<ttype
>4, $5, $7, $8); }
796 | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
797 { $$
= begin_constructor_declarator
($1, $2);
798 $$
= make_call_declarator
($$
, empty_parms
(), $4, $5);
800 | global_scope nested_name_specifier self_template_type
'('
801 { $$
= begin_constructor_declarator
($2, $3); }
802 parmlist
')' cv_qualifiers exception_specification_opt
803 { $$
= make_call_declarator
($
<ttype
>5, $6, $8, $9); }
804 | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
805 { $$
= begin_constructor_declarator
($2, $3);
806 $$
= make_call_declarator
($$
, empty_parms
(), $5, $6);
811 typed_declspecs declarator
812 { check_for_new_type
("return type", $1);
813 if
(!begin_function_definition
($1.t
, $2))
815 | declmods notype_declarator
816 { if
(!begin_function_definition
($1.t
, $2))
819 { if
(!begin_function_definition
(NULL_TREE
, $1))
821 | declmods constructor_declarator
822 { if
(!begin_function_definition
($1.t
, $2))
824 | constructor_declarator
825 { if
(!begin_function_definition
(NULL_TREE
, $1))
829 /* ANSI allows optional parentheses around constructor class names.
830 See ISO/IEC 14882:1998(E) 12.1. */
832 component_constructor_declarator:
833 SELFNAME
'(' parmlist
')' cv_qualifiers exception_specification_opt
834 { $$
= make_call_declarator
($1, $3, $5, $6); }
835 |
'(' SELFNAME
')' '(' parmlist
')' cv_qualifiers
836 exception_specification_opt
837 { $$
= make_call_declarator
($2, $5, $7, $8); }
838 | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt
839 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
840 |
'(' SELFNAME
')' LEFT_RIGHT cv_qualifiers exception_specification_opt
841 { $$
= make_call_declarator
($2, empty_parms
(), $5, $6); }
842 | self_template_type
'(' parmlist
')' cv_qualifiers exception_specification_opt
843 { $$
= make_call_declarator
($1, $3, $5, $6); }
844 | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt
845 { $$
= make_call_declarator
($1, empty_parms
(), $3, $4); }
848 /* more C++ complexity. See component_decl for a comment on the
849 reduce/reduce conflict introduced by these rules. */
851 declmods component_constructor_declarator
852 { $$
= parse_method
($2, $1.t
, $1.lookups
);
856 if
(yychar == YYEMPTY
)
859 | component_constructor_declarator
860 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
862 | typed_declspecs declarator
863 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
864 | declmods notype_declarator
865 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
867 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
869 | declmods constructor_declarator
870 { $$
= parse_method
($2, $1.t
, $1.lookups
); goto rest_of_mdef
;}
871 | constructor_declarator
872 { $$
= parse_method
($1, NULL_TREE
, NULL_TREE
);
877 RETURN_KEYWORD IDENTIFIER
885 { finish_named_return_value
($
<ttype
>$
, $2); }
886 | return_id
'(' nonnull_exprlist
')'
887 { finish_named_return_value
($
<ttype
>$
, $3); }
888 | return_id LEFT_RIGHT
889 { finish_named_return_value
($
<ttype
>$
, NULL_TREE
); }
893 ':' .set_base_init member_init_list
895 if
($3.new_type_flag
== 0)
896 error ("no base or member initializers given following ':'");
898 finish_mem_initializers
($3.t
);
905 if
(DECL_CONSTRUCTOR_P
(current_function_decl
))
906 /* Make a contour for the initializer list. */
908 else if
(current_class_type
== NULL_TREE
)
909 error ("base initializers not allowed for non-member functions");
910 else if
(! DECL_CONSTRUCTOR_P
(current_function_decl
))
911 error ("only constructors take base initializers");
918 $$.new_type_flag
= 0;
923 $$.new_type_flag
= 1;
926 | member_init_list
',' member_init
930 $$.new_type_flag
= 1;
931 TREE_CHAIN
($3) = $1.t
;
937 | member_init_list
error
941 '(' nonnull_exprlist
')'
943 if
(current_class_name
)
944 pedwarn
("anachronistic old style base class initializer");
945 $$
= expand_member_init
(current_class_ref
, NULL_TREE
, $2);
949 if
(current_class_name
)
950 pedwarn
("anachronistic old style base class initializer");
951 $$
= expand_member_init
(current_class_ref
,
955 | notype_identifier
'(' nonnull_exprlist
')'
956 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
957 | notype_identifier LEFT_RIGHT
958 { $$
= expand_member_init
(current_class_ref
, $1,
960 | nonnested_type
'(' nonnull_exprlist
')'
961 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
962 | nonnested_type LEFT_RIGHT
963 { $$
= expand_member_init
(current_class_ref
, $1,
965 | typename_sub
'(' nonnull_exprlist
')'
966 { $$
= expand_member_init
(current_class_ref
, $1, $3); }
967 | typename_sub LEFT_RIGHT
968 { $$
= expand_member_init
(current_class_ref
, $1,
994 explicit_instantiation:
995 TEMPLATE begin_explicit_instantiation typespec
';'
996 { do_type_instantiation
($3.t
, NULL_TREE
, 1);
998 end_explicit_instantiation
999 | TEMPLATE begin_explicit_instantiation typed_declspecs declarator
1000 { tree specs
= strip_attrs
($3.t
);
1001 do_decl_instantiation
(specs
, $4, NULL_TREE
); }
1002 end_explicit_instantiation
1003 | TEMPLATE begin_explicit_instantiation notype_declarator
1004 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
1005 end_explicit_instantiation
1006 | TEMPLATE begin_explicit_instantiation constructor_declarator
1007 { do_decl_instantiation
(NULL_TREE
, $3, NULL_TREE
); }
1008 end_explicit_instantiation
1009 | SCSPEC TEMPLATE begin_explicit_instantiation typespec
';'
1010 { do_type_instantiation
($4.t
, $1, 1);
1011 yyungetc
(';', 1); }
1012 end_explicit_instantiation
1013 | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs
1015 { tree specs
= strip_attrs
($4.t
);
1016 do_decl_instantiation
(specs
, $5, $1); }
1017 end_explicit_instantiation
1018 | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator
1019 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1020 end_explicit_instantiation
1021 | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator
1022 { do_decl_instantiation
(NULL_TREE
, $4, $1); }
1023 end_explicit_instantiation
1026 begin_explicit_instantiation:
1027 { begin_explicit_instantiation
(); }
1029 end_explicit_instantiation:
1030 { end_explicit_instantiation
(); }
1032 /* The TYPENAME expansions are to deal with use of a template class name as
1033 a template within the class itself, where the template decl is hidden by
1034 a type decl. Got all that? */
1037 PTYPENAME
'<' template_arg_list_opt template_close_bracket
1038 .finish_template_type
1040 | TYPENAME
'<' template_arg_list_opt template_close_bracket
1041 .finish_template_type
1043 | self_template_type
1046 apparent_template_type:
1048 | identifier
'<' template_arg_list_opt
'>'
1049 .finish_template_type
1053 SELFNAME
'<' template_arg_list_opt template_close_bracket
1054 .finish_template_type
1058 .finish_template_type
:
1060 if
(yychar == YYEMPTY
)
1063 $$
= finish_template_type
($
<ttype
>-3, $
<ttype
>-1,
1067 template_close_bracket:
1071 /* Handle `Class<Class<Type>>' without space in the `>>' */
1072 pedwarn
("`>>' should be `> >' in template class name");
1077 template_arg_list_opt:
1085 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1086 | template_arg_list
',' template_arg
1087 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1092 { $$
= groktypename
($1.t
); }
1096 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1097 $$
= TREE_TYPE
($$
);
1099 | global_scope PTYPENAME
1102 if
(DECL_TEMPLATE_TEMPLATE_PARM_P
($$
))
1103 $$
= TREE_TYPE
($$
);
1105 | expr_no_comma_rangle
1106 | nested_name_specifier TEMPLATE identifier
1108 if
(!processing_template_decl
)
1110 cp_error
("use of template qualifier outside template");
1111 $$
= error_mark_node
;
1114 $$
= make_unbound_class_template
($1, $3, 1);
1120 { $$
= NEGATE_EXPR
; }
1122 { $$
= CONVERT_EXPR
; }
1124 { $$
= PREINCREMENT_EXPR
; }
1126 { $$
= PREDECREMENT_EXPR
; }
1128 { $$
= TRUTH_NOT_EXPR
; }
1133 { $$
= build_x_compound_expr
($$
); }
1139 { error ("ISO C++ forbids an empty condition for `%s'",
1141 $$
= integer_zero_node
; }
1148 { error ("ISO C++ forbids an empty condition for `%s'",
1150 $$
= integer_zero_node
; }
1164 type_specifier_seq declarator maybeasm maybe_attribute
'='
1167 for
(d
= getdecls
(); d
; d
= TREE_CHAIN
(d
))
1168 if
(TREE_CODE
(d
) == TYPE_DECL
) {
1169 tree s
= TREE_TYPE
(d
);
1170 if
(TREE_CODE
(s
) == RECORD_TYPE
)
1171 cp_error
("definition of class `%T' in condition", s
);
1172 else if
(TREE_CODE
(s
) == ENUMERAL_TYPE
)
1173 cp_error
("definition of enum `%T' in condition", s
);
1176 current_declspecs
= $1.t
;
1177 $
<ttype
>$
= parse_decl
($
<ttype
>2, $4, 1);
1181 parse_end_decl
($
<ttype
>6, $7, $4);
1182 $$
= convert_from_reference
($
<ttype
>6);
1183 if
(TREE_CODE
(TREE_TYPE
($$
)) == ARRAY_TYPE
)
1184 cp_error
("definition of array `%#D' in condition", $$
);
1191 | maybe_label_decls stmts
'}'
1192 | maybe_label_decls stmts
error '}'
1193 | maybe_label_decls
error '}'
1196 nontrivial_exprlist:
1197 expr_no_commas
',' expr_no_commas
1198 { $$
= tree_cons
(NULL_TREE
, $$
,
1199 build_tree_list
(NULL_TREE
, $3)); }
1200 | expr_no_commas
',' error
1201 { $$
= tree_cons
(NULL_TREE
, $$
,
1202 build_tree_list
(NULL_TREE
, error_mark_node
)); }
1203 | nontrivial_exprlist
',' expr_no_commas
1204 { chainon
($$
, build_tree_list
(NULL_TREE
, $3)); }
1205 | nontrivial_exprlist
',' error
1206 { chainon
($$
, build_tree_list
(NULL_TREE
, error_mark_node
)); }
1211 { $$
= build_tree_list
(NULL_TREE
, $$
); }
1212 | nontrivial_exprlist
1218 /* __extension__ turns off -pedantic for following primary. */
1219 | extension cast_expr %prec UNARY
1222 |
'*' cast_expr %prec UNARY
1223 { $$
= build_x_indirect_ref
($2, "unary *"); }
1224 |
'&' cast_expr %prec UNARY
1225 { $$
= build_x_unary_op
(ADDR_EXPR
, $2); }
1227 { $$
= build_x_unary_op
(BIT_NOT_EXPR
, $2); }
1228 | unop cast_expr %prec UNARY
1229 { $$
= finish_unary_op_expr
($1, $2); }
1230 /* Refer to the address of a label as a pointer. */
1232 { $$
= finish_label_address_expr
($2); }
1233 | SIZEOF unary_expr %prec UNARY
1234 { $$
= finish_sizeof
($2); }
1235 | SIZEOF
'(' type_id
')' %prec HYPERUNARY
1236 { $$
= finish_sizeof
(groktypename
($3.t
));
1237 check_for_new_type
("sizeof", $3); }
1238 | ALIGNOF unary_expr %prec UNARY
1239 { $$
= finish_alignof
($2); }
1240 | ALIGNOF
'(' type_id
')' %prec HYPERUNARY
1241 { $$
= finish_alignof
(groktypename
($3.t
));
1242 check_for_new_type
("alignof", $3); }
1244 /* The %prec EMPTY's here are required by the = init initializer
1245 syntax extension; see below. */
1246 | new new_type_id %prec EMPTY
1247 { $$
= build_new
(NULL_TREE
, $2.t
, NULL_TREE
, $1);
1248 check_for_new_type
("new", $2); }
1249 | new new_type_id new_initializer
1250 { $$
= build_new
(NULL_TREE
, $2.t
, $3, $1);
1251 check_for_new_type
("new", $2); }
1252 | new new_placement new_type_id %prec EMPTY
1253 { $$
= build_new
($2, $3.t
, NULL_TREE
, $1);
1254 check_for_new_type
("new", $3); }
1255 | new new_placement new_type_id new_initializer
1256 { $$
= build_new
($2, $3.t
, $4, $1);
1257 check_for_new_type
("new", $3); }
1258 | new
'(' type_id
')'
1260 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
),
1262 check_for_new_type
("new", $3); }
1263 | new
'(' type_id
')' new_initializer
1264 { $$
= build_new
(NULL_TREE
, groktypename
($3.t
), $5, $1);
1265 check_for_new_type
("new", $3); }
1266 | new new_placement
'(' type_id
')' %prec EMPTY
1267 { $$
= build_new
($2, groktypename
($4.t
), NULL_TREE
, $1);
1268 check_for_new_type
("new", $4); }
1269 | new new_placement
'(' type_id
')' new_initializer
1270 { $$
= build_new
($2, groktypename
($4.t
), $6, $1);
1271 check_for_new_type
("new", $4); }
1273 | delete cast_expr %prec UNARY
1274 { $$
= delete_sanity
($2, NULL_TREE
, 0, $1); }
1275 | delete
'[' ']' cast_expr %prec UNARY
1276 { $$
= delete_sanity
($4, NULL_TREE
, 1, $1);
1277 if
(yychar == YYEMPTY
)
1279 | delete
'[' expr
']' cast_expr %prec UNARY
1280 { $$
= delete_sanity
($5, $3, 2, $1);
1281 if
(yychar == YYEMPTY
)
1283 | REALPART cast_expr %prec UNARY
1284 { $$
= build_x_unary_op
(REALPART_EXPR
, $2); }
1285 | IMAGPART cast_expr %prec UNARY
1286 { $$
= build_x_unary_op
(IMAGPART_EXPR
, $2); }
1290 '(' nonnull_exprlist
')'
1292 |
'{' nonnull_exprlist
'}'
1293 { cp_pedwarn
("old style placement syntax, use () instead");
1298 '(' nonnull_exprlist
')'
1301 { $$
= void_zero_node
; }
1304 cp_error
("`%T' is not a valid expression", $2.t
);
1305 $$
= error_mark_node
;
1307 /* GNU extension so people can use initializer lists. Note that
1308 this alters the meaning of `new int = 1', which was previously
1309 syntactically valid but semantically invalid.
1310 This feature is now deprecated and will be removed in a future
1315 pedwarn
("ISO C++ forbids initialization of new expression with `='");
1316 cp_deprecated
("new initializer lists extension");
1317 if
(TREE_CODE
($2) != TREE_LIST
1318 && TREE_CODE
($2) != CONSTRUCTOR
)
1319 $$
= build_tree_list
(NULL_TREE
, $2);
1325 /* This is necessary to postpone reduction of `int ((int)(int)(int))'. */
1327 '(' type_id
')' %prec EMPTY
1328 { $2.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $2.t
), 0);
1329 $$
= make_call_declarator
(NULL_TREE
, $2.t
, NULL_TREE
, NULL_TREE
);
1330 check_for_new_type
("cast", $2); }
1331 | regcast_or_absdcl
'(' type_id
')' %prec EMPTY
1332 { $3.t
= finish_parmlist
(build_tree_list
(NULL_TREE
, $3.t
), 0);
1333 $$
= make_call_declarator
($$
, $3.t
, NULL_TREE
, NULL_TREE
);
1334 check_for_new_type
("cast", $3); }
1339 | regcast_or_absdcl unary_expr %prec UNARY
1340 { $$
= reparse_absdcl_as_casts
($$
, $2); }
1341 | regcast_or_absdcl
'{' initlist maybecomma
'}' %prec UNARY
1343 tree init
= build_nt
(CONSTRUCTOR
, NULL_TREE
,
1346 pedwarn
("ISO C++ forbids compound literals");
1347 /* Indicate that this was a C99 compound literal. */
1348 TREE_HAS_CONSTRUCTOR
(init
) = 1;
1350 $$
= reparse_absdcl_as_casts
($$
, init
);
1356 /* Handle general members. */
1357 | expr_no_commas POINTSAT_STAR expr_no_commas
1358 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1359 | expr_no_commas DOT_STAR expr_no_commas
1360 { $$
= build_m_component_ref
($$
, $3); }
1361 | expr_no_commas
'+' expr_no_commas
1362 { $$
= build_x_binary_op
($2, $$
, $3); }
1363 | expr_no_commas
'-' expr_no_commas
1364 { $$
= build_x_binary_op
($2, $$
, $3); }
1365 | expr_no_commas
'*' expr_no_commas
1366 { $$
= build_x_binary_op
($2, $$
, $3); }
1367 | expr_no_commas
'/' expr_no_commas
1368 { $$
= build_x_binary_op
($2, $$
, $3); }
1369 | expr_no_commas
'%' expr_no_commas
1370 { $$
= build_x_binary_op
($2, $$
, $3); }
1371 | expr_no_commas LSHIFT expr_no_commas
1372 { $$
= build_x_binary_op
($2, $$
, $3); }
1373 | expr_no_commas RSHIFT expr_no_commas
1374 { $$
= build_x_binary_op
($2, $$
, $3); }
1375 | expr_no_commas ARITHCOMPARE expr_no_commas
1376 { $$
= build_x_binary_op
($2, $$
, $3); }
1377 | expr_no_commas
'<' expr_no_commas
1378 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1379 | expr_no_commas
'>' expr_no_commas
1380 { $$
= build_x_binary_op
(GT_EXPR
, $$
, $3); }
1381 | expr_no_commas EQCOMPARE expr_no_commas
1382 { $$
= build_x_binary_op
($2, $$
, $3); }
1383 | expr_no_commas MIN_MAX expr_no_commas
1384 { $$
= build_x_binary_op
($2, $$
, $3); }
1385 | expr_no_commas
'&' expr_no_commas
1386 { $$
= build_x_binary_op
($2, $$
, $3); }
1387 | expr_no_commas
'|' expr_no_commas
1388 { $$
= build_x_binary_op
($2, $$
, $3); }
1389 | expr_no_commas
'^' expr_no_commas
1390 { $$
= build_x_binary_op
($2, $$
, $3); }
1391 | expr_no_commas ANDAND expr_no_commas
1392 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1393 | expr_no_commas OROR expr_no_commas
1394 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1395 | expr_no_commas
'?' xexpr
':' expr_no_commas
1396 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1397 | expr_no_commas
'=' expr_no_commas
1398 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1399 if
($$
!= error_mark_node
)
1400 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1401 | expr_no_commas ASSIGN expr_no_commas
1402 { $$
= build_x_modify_expr
($$
, $2, $3); }
1404 { $$
= build_throw
(NULL_TREE
); }
1405 | THROW expr_no_commas
1406 { $$
= build_throw
($2); }
1409 expr_no_comma_rangle:
1411 /* Handle general members. */
1412 | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle
1413 { $$
= build_x_binary_op
(MEMBER_REF
, $$
, $3); }
1414 | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle
1415 { $$
= build_m_component_ref
($$
, $3); }
1416 | expr_no_comma_rangle
'+' expr_no_comma_rangle
1417 { $$
= build_x_binary_op
($2, $$
, $3); }
1418 | expr_no_comma_rangle
'-' expr_no_comma_rangle
1419 { $$
= build_x_binary_op
($2, $$
, $3); }
1420 | expr_no_comma_rangle
'*' expr_no_comma_rangle
1421 { $$
= build_x_binary_op
($2, $$
, $3); }
1422 | expr_no_comma_rangle
'/' expr_no_comma_rangle
1423 { $$
= build_x_binary_op
($2, $$
, $3); }
1424 | expr_no_comma_rangle
'%' expr_no_comma_rangle
1425 { $$
= build_x_binary_op
($2, $$
, $3); }
1426 | expr_no_comma_rangle LSHIFT expr_no_comma_rangle
1427 { $$
= build_x_binary_op
($2, $$
, $3); }
1428 | expr_no_comma_rangle RSHIFT expr_no_comma_rangle
1429 { $$
= build_x_binary_op
($2, $$
, $3); }
1430 | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle
1431 { $$
= build_x_binary_op
($2, $$
, $3); }
1432 | expr_no_comma_rangle
'<' expr_no_comma_rangle
1433 { $$
= build_x_binary_op
(LT_EXPR
, $$
, $3); }
1434 | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle
1435 { $$
= build_x_binary_op
($2, $$
, $3); }
1436 | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle
1437 { $$
= build_x_binary_op
($2, $$
, $3); }
1438 | expr_no_comma_rangle
'&' expr_no_comma_rangle
1439 { $$
= build_x_binary_op
($2, $$
, $3); }
1440 | expr_no_comma_rangle
'|' expr_no_comma_rangle
1441 { $$
= build_x_binary_op
($2, $$
, $3); }
1442 | expr_no_comma_rangle
'^' expr_no_comma_rangle
1443 { $$
= build_x_binary_op
($2, $$
, $3); }
1444 | expr_no_comma_rangle ANDAND expr_no_comma_rangle
1445 { $$
= build_x_binary_op
(TRUTH_ANDIF_EXPR
, $$
, $3); }
1446 | expr_no_comma_rangle OROR expr_no_comma_rangle
1447 { $$
= build_x_binary_op
(TRUTH_ORIF_EXPR
, $$
, $3); }
1448 | expr_no_comma_rangle
'?' xexpr
':' expr_no_comma_rangle
1449 { $$
= build_x_conditional_expr
($$
, $3, $5); }
1450 | expr_no_comma_rangle
'=' expr_no_comma_rangle
1451 { $$
= build_x_modify_expr
($$
, NOP_EXPR
, $3);
1452 if
($$
!= error_mark_node
)
1453 C_SET_EXP_ORIGINAL_CODE
($$
, MODIFY_EXPR
); }
1454 | expr_no_comma_rangle ASSIGN expr_no_comma_rangle
1455 { $$
= build_x_modify_expr
($$
, $2, $3); }
1457 { $$
= build_throw
(NULL_TREE
); }
1458 | THROW expr_no_comma_rangle
1459 { $$
= build_throw
($2); }
1462 notype_unqualified_id:
1463 '~' see_typename identifier
1464 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1465 |
'~' see_typename template_type
1466 { $$
= build_nt
(BIT_NOT_EXPR
, $3); }
1471 | NSNAME %prec EMPTY
1476 /* If lastiddecl is a TREE_LIST, it's a baselink, which
1477 means that we're in an expression like S::f<int>, so
1478 don't do_identifier; we only do that for unqualified
1480 if
(!lastiddecl || TREE_CODE
(lastiddecl
) != TREE_LIST
)
1481 $$
= do_identifier
($
<ttype
>-1, 1, NULL_TREE
);
1487 PFUNCNAME
'<' do_id template_arg_list_opt template_close_bracket
1488 { $$
= lookup_template_function
($3, $4); }
1489 | operator_name
'<' do_id template_arg_list_opt template_close_bracket
1490 { $$
= lookup_template_function
($3, $4); }
1494 TEMPLATE identifier
'<' template_arg_list_opt template_close_bracket
1495 { $$
= lookup_template_function
($2, $4); }
1496 | TEMPLATE PFUNCNAME
'<' template_arg_list_opt template_close_bracket
1497 { $$
= lookup_template_function
($2, $4); }
1498 | TEMPLATE operator_name
'<' template_arg_list_opt
1499 template_close_bracket
1500 { $$
= lookup_template_function
($2, $4); }
1504 notype_unqualified_id
1509 expr_or_declarator_intern:
1511 | attributes expr_or_declarator
1513 /* Provide support for '(' attributes '*' declarator ')'
1515 $$
= tree_cons
($1, $2, NULL_TREE
);
1520 notype_unqualified_id
1521 |
'*' expr_or_declarator_intern %prec UNARY
1522 { $$
= build_nt
(INDIRECT_REF
, $2); }
1523 |
'&' expr_or_declarator_intern %prec UNARY
1524 { $$
= build_nt
(ADDR_EXPR
, $2); }
1525 |
'(' expr_or_declarator_intern
')'
1529 notype_template_declarator:
1530 IDENTIFIER
'<' template_arg_list_opt template_close_bracket
1531 { $$
= lookup_template_function
($1, $3); }
1532 | NSNAME
'<' template_arg_list template_close_bracket
1533 { $$
= lookup_template_function
($1, $3); }
1536 direct_notype_declarator:
1537 complex_direct_notype_declarator
1538 /* This precedence declaration is to prefer this reduce
1539 to the Koenig lookup shift in primary, below. I hate yacc. */
1540 | notype_unqualified_id %prec
'('
1541 | notype_template_declarator
1542 |
'(' expr_or_declarator_intern
')'
1543 { $$
= finish_decl_parsing
($2); }
1547 notype_unqualified_id
1549 if
(TREE_CODE
($1) == BIT_NOT_EXPR
)
1550 $$
= build_x_unary_op
(BIT_NOT_EXPR
, TREE_OPERAND
($1, 0));
1552 $$
= finish_id_expr
($1);
1558 $$
= combine_strings
($$
);
1559 /* combine_strings doesn't set up TYPE_MAIN_VARIANT of
1560 a const array the way we want, so fix it. */
1561 if
(flag_const_strings
)
1562 TREE_TYPE
($$
) = build_cplus_array_type
1563 (TREE_TYPE
(TREE_TYPE
($$
)),
1564 TYPE_DOMAIN
(TREE_TYPE
($$
)));
1568 $$
= fname_decl
(C_RID_CODE
($$
), $$
);
1569 if
(processing_template_decl
)
1570 $$
= build_min_nt
(LOOKUP_EXPR
, DECL_NAME
($$
));
1573 { $$
= finish_parenthesized_expr
($2); }
1574 |
'(' expr_or_declarator_intern
')'
1575 { $2 = reparse_decl_as_expr
(NULL_TREE
, $2);
1576 $$
= finish_parenthesized_expr
($2); }
1578 { $$
= error_mark_node
; }
1580 { tree scope
= current_scope
();
1581 if
(!scope || TREE_CODE
(scope
) != FUNCTION_DECL
)
1583 error ("braced-group within expression allowed only inside a function");
1587 pedwarn
("ISO C++ forbids braced-groups within expressions");
1588 $
<ttype
>$
= begin_stmt_expr
();
1591 { $$
= finish_stmt_expr
($
<ttype
>2); }
1592 /* Koenig lookup support
1593 We could store lastiddecl in $1 to avoid another lookup,
1594 but that would result in many additional reduce/reduce conflicts. */
1595 | notype_unqualified_id
'(' nonnull_exprlist
')'
1596 { $$
= finish_call_expr
($1, $3, 1); }
1597 | notype_unqualified_id LEFT_RIGHT
1598 { $$
= finish_call_expr
($1, NULL_TREE
, 1); }
1599 | primary
'(' nonnull_exprlist
')'
1600 { $$
= finish_call_expr
($1, $3, 0); }
1601 | primary LEFT_RIGHT
1602 { $$
= finish_call_expr
($1, NULL_TREE
, 0); }
1603 | VA_ARG
'(' expr_no_commas
',' type_id
')'
1604 { $$
= build_x_va_arg
($3, groktypename
($5.t
));
1605 check_for_new_type
("__builtin_va_arg", $5); }
1606 | primary
'[' expr
']'
1607 { $$
= grok_array_decl
($$
, $3); }
1609 { $$
= finish_increment_expr
($1, POSTINCREMENT_EXPR
); }
1610 | primary MINUSMINUS
1611 { $$
= finish_increment_expr
($1, POSTDECREMENT_EXPR
); }
1612 /* C++ extensions */
1614 { $$
= finish_this_expr
(); }
1615 | CV_QUALIFIER
'(' nonnull_exprlist
')'
1617 /* This is a C cast in C++'s `functional' notation
1618 using the "implicit int" extension so that:
1619 `const (3)' is equivalent to `const int (3)'. */
1622 type
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1623 type
= groktypename
(build_tree_list
(type
, NULL_TREE
));
1624 $$
= build_functional_cast
(type
, $3);
1627 | DYNAMIC_CAST
'<' type_id
'>' '(' expr
')'
1628 { tree type
= groktypename
($3.t
);
1629 check_for_new_type
("dynamic_cast", $3);
1630 $$
= build_dynamic_cast
(type
, $6); }
1631 | STATIC_CAST
'<' type_id
'>' '(' expr
')'
1632 { tree type
= groktypename
($3.t
);
1633 check_for_new_type
("static_cast", $3);
1634 $$
= build_static_cast
(type
, $6); }
1635 | REINTERPRET_CAST
'<' type_id
'>' '(' expr
')'
1636 { tree type
= groktypename
($3.t
);
1637 check_for_new_type
("reinterpret_cast", $3);
1638 $$
= build_reinterpret_cast
(type
, $6); }
1639 | CONST_CAST
'<' type_id
'>' '(' expr
')'
1640 { tree type
= groktypename
($3.t
);
1641 check_for_new_type
("const_cast", $3);
1642 $$
= build_const_cast
(type
, $6); }
1643 | TYPEID
'(' expr
')'
1644 { $$
= build_typeid
($3); }
1645 | TYPEID
'(' type_id
')'
1646 { tree type
= groktypename
($3.t
);
1647 check_for_new_type
("typeid", $3);
1648 $$
= get_typeid
(TYPE_MAIN_VARIANT
(type
)); }
1649 | global_scope IDENTIFIER
1650 { $$
= do_scoped_id
($2, 1); }
1651 | global_scope template_id
1653 | global_scope operator_name
1655 got_scope
= NULL_TREE
;
1656 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
1657 $$
= do_scoped_id
($2, 1);
1661 | overqualified_id %prec HYPERUNARY
1662 { $$
= build_offset_ref
(OP0
($$
), OP1
($$
)); }
1663 | overqualified_id
'(' nonnull_exprlist
')'
1664 { $$
= finish_qualified_call_expr
($1, $3); }
1665 | overqualified_id LEFT_RIGHT
1666 { $$
= finish_qualified_call_expr
($1, NULL_TREE
); }
1667 | object object_template_id %prec UNARY
1669 $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1);
1671 | object object_template_id
'(' nonnull_exprlist
')'
1672 { $$
= finish_object_call_expr
($2, $1, $4); }
1673 | object object_template_id LEFT_RIGHT
1674 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1675 | object unqualified_id %prec UNARY
1676 { $$
= build_x_component_ref
($$
, $2, NULL_TREE
, 1); }
1677 | object overqualified_id %prec UNARY
1678 { if
(processing_template_decl
)
1679 $$
= build_min_nt
(COMPONENT_REF
, $1, $2);
1681 $$
= build_object_ref
($$
, OP0
($2), OP1
($2)); }
1682 | object unqualified_id
'(' nonnull_exprlist
')'
1683 { $$
= finish_object_call_expr
($2, $1, $4); }
1684 | object unqualified_id LEFT_RIGHT
1685 { $$
= finish_object_call_expr
($2, $1, NULL_TREE
); }
1686 | object overqualified_id
'(' nonnull_exprlist
')'
1687 { $$
= finish_qualified_object_call_expr
($2, $1, $4); }
1688 | object overqualified_id LEFT_RIGHT
1689 { $$
= finish_qualified_object_call_expr
($2, $1, NULL_TREE
); }
1690 /* p->int::~int() is valid -- 12.4 */
1691 | object
'~' TYPESPEC LEFT_RIGHT
1692 { $$
= finish_pseudo_destructor_call_expr
($1, NULL_TREE
, $3); }
1693 | object TYPESPEC SCOPE
'~' TYPESPEC LEFT_RIGHT
1694 { $$
= finish_pseudo_destructor_call_expr
($1, $2, $5); }
1697 $$
= error_mark_node
;
1701 /* Not needed for now.
1707 { $$ = error_mark_node; }
1709 { if (current_function_decl == 0)
1711 error ("braced-group within expression allowed only inside a function");
1714 $<ttype>$ = expand_start_stmt_expr (); }
1717 pedwarn ("ISO C++ forbids braced-groups within expressions");
1718 $$ = expand_end_stmt_expr ($<ttype>2); }
1719 | primary_no_id '(' nonnull_exprlist ')'
1720 { $$ = build_x_function_call ($$, $3, current_class_ref); }
1721 | primary_no_id LEFT_RIGHT
1722 { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); }
1723 | primary_no_id '[' expr ']'
1725 | primary_no_id PLUSPLUS
1726 { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
1727 | primary_no_id MINUSMINUS
1728 { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
1730 { goto do_scoped_id; }
1731 | SCOPE operator_name
1732 { if (TREE_CODE ($2) == IDENTIFIER_NODE)
1734 goto do_scoped_operator;
1743 { got_scope
= NULL_TREE
; $$
= 1; }
1749 | global_scope delete
1750 { got_scope
= NULL_TREE
; $$
= 1; }
1755 { $$
= boolean_true_node
; }
1757 { $$
= boolean_false_node
; }
1760 /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
1764 { $$
= chainon
($$
, $2); }
1770 setup_vtbl_ptr
(NULL_TREE
, NULL_TREE
);
1776 { got_object
= TREE_TYPE
($$
); }
1779 $$
= build_x_arrow
($$
);
1780 got_object
= TREE_TYPE
($$
);
1785 typespec initdecls
';'
1787 if
($1.t
&& IS_AGGR_TYPE_CODE
(TREE_CODE
($1.t
)))
1788 note_got_semicolon
($1.t
);
1790 | typed_declspecs initdecls
';'
1792 note_list_got_semicolon
($1.t
);
1794 | declmods notype_initdecls
';'
1796 | typed_declspecs
';'
1799 note_list_got_semicolon
($1.t
);
1802 { warning
("empty declaration"); }
1807 /* Any kind of declarator (thus, all declarators allowed
1808 after an explicit typespec). */
1811 after_type_declarator %prec EMPTY
1812 | notype_declarator %prec EMPTY
1815 /* This is necessary to postpone reduction of `int()()()()'. */
1817 LEFT_RIGHT %prec EMPTY
1818 { $$
= make_call_declarator
(NULL_TREE
, empty_parms
(),
1819 NULL_TREE
, NULL_TREE
); }
1820 | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
1821 { $$
= make_call_declarator
($$
, empty_parms
(), NULL_TREE
,
1825 /* ISO type-id (8.1) */
1827 typed_typespecs absdcl
1828 { $$.t
= build_tree_list
($1.t
, $2);
1829 $$.new_type_flag
= $1.new_type_flag
; }
1830 | nonempty_cv_qualifiers absdcl
1831 { $$.t
= build_tree_list
($1.t
, $2);
1832 $$.new_type_flag
= $1.new_type_flag
; }
1834 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
1836 $$.new_type_flag
= $1.new_type_flag
; }
1837 | typed_typespecs %prec EMPTY
1838 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1839 $$.new_type_flag
= $1.new_type_flag
; }
1840 | nonempty_cv_qualifiers %prec EMPTY
1841 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
1842 $$.new_type_flag
= $1.new_type_flag
; }
1845 /* Declspecs which contain at least one type specifier or typedef name.
1846 (Just `const' or `volatile' is not enough.)
1847 A typedef'd name following these is taken as a name to be declared.
1848 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1851 typed_typespecs %prec EMPTY
1852 { $$.lookups
= type_lookups
; }
1854 { $$.lookups
= type_lookups
; }
1859 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1860 $$.new_type_flag
= $2.new_type_flag
; }
1861 | typespec reserved_declspecs %prec HYPERUNARY
1862 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1863 $$.new_type_flag
= $1.new_type_flag
; }
1864 | typespec reserved_typespecquals reserved_declspecs
1865 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, chainon
($2, $3));
1866 $$.new_type_flag
= $1.new_type_flag
; }
1867 | declmods typespec reserved_declspecs
1868 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1869 $$.new_type_flag
= $2.new_type_flag
; }
1870 | declmods typespec reserved_typespecquals
1871 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1872 $$.new_type_flag
= $2.new_type_flag
; }
1873 | declmods typespec reserved_typespecquals reserved_declspecs
1874 { $$.t
= tree_cons
(NULL_TREE
, $2.t
,
1875 chainon
($3, chainon
($4, $1.t
)));
1876 $$.new_type_flag
= $2.new_type_flag
; }
1881 { if
(extra_warnings
)
1882 warning
("`%s' is not at beginning of declaration",
1883 IDENTIFIER_POINTER
($$
));
1884 $$
= build_tree_list
(NULL_TREE
, $$
); }
1885 | reserved_declspecs typespecqual_reserved
1886 { $$
= tree_cons
(NULL_TREE
, $2.t
, $$
); }
1887 | reserved_declspecs SCSPEC
1888 { if
(extra_warnings
)
1889 warning
("`%s' is not at beginning of declaration",
1890 IDENTIFIER_POINTER
($2));
1891 $$
= tree_cons
(NULL_TREE
, $2, $$
); }
1892 | reserved_declspecs attributes
1893 { $$
= tree_cons
($2, NULL_TREE
, $1); }
1895 { $$
= tree_cons
($1, NULL_TREE
, NULL_TREE
); }
1898 /* List of just storage classes and type modifiers.
1899 A declaration can start with just this, but then it cannot be used
1900 to redeclare a typedef-name.
1901 In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */
1903 /* We use hash_tree_cons for lists of typeless declspecs so that they end
1904 up on a persistent obstack. Otherwise, they could appear at the
1905 beginning of something like
1907 static const struct { int foo () { } } b;
1909 and would be discarded after we finish compiling foo. We don't need to
1910 worry once we see a type. */
1913 nonempty_cv_qualifiers %prec EMPTY
1914 { $$.lookups
= NULL_TREE
; TREE_STATIC
($$.t
) = 1; }
1917 $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
1918 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1920 | declmods CV_QUALIFIER
1922 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1923 TREE_STATIC
($$.t
) = 1;
1927 if
(extra_warnings
&& TREE_STATIC
($$.t
))
1928 warning
("`%s' is not at beginning of declaration",
1929 IDENTIFIER_POINTER
($2));
1930 $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
1931 TREE_STATIC
($$.t
) = TREE_STATIC
($1.t
);
1933 | declmods attributes
1934 { $$.t
= hash_tree_cons
($2, NULL_TREE
, $1.t
); }
1935 | attributes %prec EMPTY
1937 $$.t
= hash_tree_cons
($1, NULL_TREE
, NULL_TREE
);
1938 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1942 /* Used instead of declspecs where storage classes are not allowed
1943 (that is, for typenames and structure components).
1945 C++ can takes storage classes for structure components.
1946 Don't accept a typedef-name if anything but a modifier precedes it. */
1949 typespec %prec EMPTY
1950 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
1951 $$.new_type_flag
= $1.new_type_flag
; }
1952 | nonempty_cv_qualifiers typespec
1953 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, $1.t
);
1954 $$.new_type_flag
= $2.new_type_flag
; }
1955 | typespec reserved_typespecquals
1956 { $$.t
= tree_cons
(NULL_TREE
, $1.t
, $2);
1957 $$.new_type_flag
= $1.new_type_flag
; }
1958 | nonempty_cv_qualifiers typespec reserved_typespecquals
1959 { $$.t
= tree_cons
(NULL_TREE
, $2.t
, chainon
($3, $1.t
));
1960 $$.new_type_flag
= $2.new_type_flag
; }
1963 reserved_typespecquals:
1964 typespecqual_reserved
1965 { $$
= build_tree_list
(NULL_TREE
, $1.t
); }
1966 | reserved_typespecquals typespecqual_reserved
1967 { $$
= tree_cons
(NULL_TREE
, $2.t
, $1); }
1970 /* A typespec (but not a type qualifier).
1971 Once we have seen one of these in a declaration,
1972 if a typedef name appears then it is being redeclared. */
1976 { $$.lookups
= NULL_TREE
; }
1977 | TYPESPEC %prec EMPTY
1978 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1979 | complete_type_name
1980 { $$.t
= $1; $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1981 | TYPEOF
'(' expr
')'
1982 { $$.t
= finish_typeof
($3);
1983 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1984 | TYPEOF
'(' type_id
')'
1985 { $$.t
= groktypename
($3.t
);
1986 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
; }
1987 | SIGOF
'(' expr
')'
1988 { tree type
= TREE_TYPE
($3);
1990 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
1991 if
(IS_AGGR_TYPE
(type
))
1993 sorry
("sigof type specifier");
1998 error ("`sigof' applied to non-aggregate expression");
1999 $$.t
= error_mark_node
;
2002 | SIGOF
'(' type_id
')'
2003 { tree type
= groktypename
($3.t
);
2005 $$.new_type_flag
= 0; $$.lookups
= NULL_TREE
;
2006 if
(IS_AGGR_TYPE
(type
))
2008 sorry
("sigof type specifier");
2013 error("`sigof' applied to non-aggregate type");
2014 $$.t
= error_mark_node
;
2019 /* A typespec that is a reserved word, or a type qualifier. */
2021 typespecqual_reserved:
2023 { $$.t
= $1; $$.new_type_flag
= 0; }
2025 { $$.t
= $1; $$.new_type_flag
= 0; }
2031 | initdecls
',' initdcl
2032 { check_multiple_declarators
(); }
2037 | notype_initdecls
',' initdcl
2038 { check_multiple_declarators
(); }
2043 | nomods_initdecls
',' initdcl
2044 { check_multiple_declarators
(); }
2050 | asm_keyword
'(' string ')'
2051 { if
(TREE_CHAIN
($3)) $3 = combine_strings
($3); $$
= $3; }
2055 declarator maybeasm maybe_attribute
'='
2056 { $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 1); }
2058 /* Note how the declaration of the variable is in effect while its init is parsed! */
2059 { parse_end_decl
($
<ttype
>5, $6, $2); }
2060 | declarator maybeasm maybe_attribute
2062 $
<ttype
>$
= parse_decl
($
<ttype
>1, $3, 0);
2063 parse_end_decl
($
<ttype
>$
, NULL_TREE
, $2);
2067 /* This rule assumes a certain configuration of the parser stack.
2068 In particular, $0, the element directly before the beginning of
2069 this rule on the stack, must be a maybeasm. $-1 must be a
2070 declarator or notype_declarator. And $-2 must be some declmods
2071 or declspecs. We can't move the maybeasm into this rule because
2072 we need that reduce so we prefer fn.def1 when appropriate. */
2075 { $
<ttype
>$
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2076 $
<ftype
>-2.lookups
, $1, 1); }
2077 /* Note how the declaration of the variable is in effect
2078 while its init is parsed! */
2080 { parse_end_decl
($
<ttype
>3, $4, $
<ttype
>0); }
2082 { tree d
= parse_decl0
($
<ttype
>-1, $
<ftype
>-2.t
,
2083 $
<ftype
>-2.lookups
, $1, 0);
2084 parse_end_decl
(d
, NULL_TREE
, $
<ttype
>0); }
2088 declarator maybeasm initdcl0_innards
2093 notype_declarator maybeasm initdcl0_innards
2098 notype_declarator maybeasm
2099 { /* Set things up as initdcl0_innards expects. */
2102 $
<ftype
>1.t
= NULL_TREE
;
2103 $
<ftype
>1.lookups
= NULL_TREE
; }
2106 | constructor_declarator maybeasm maybe_attribute
2107 { tree d
= parse_decl0
($1, NULL_TREE
, NULL_TREE
, $3, 0);
2108 parse_end_decl
(d
, NULL_TREE
, $2); }
2111 /* the * rules are dummies to accept the Apollo extended syntax
2112 so that the header files compile. */
2123 | attributes attribute
2124 { $$
= chainon
($1, $2); }
2128 ATTRIBUTE
'(' '(' attribute_list
')' ')'
2135 | attribute_list
',' attrib
2136 { $$
= chainon
($1, $3); }
2143 { $$
= build_tree_list
($1, NULL_TREE
); }
2144 | any_word
'(' IDENTIFIER
')'
2145 { $$
= build_tree_list
($1, build_tree_list
(NULL_TREE
, $3)); }
2146 | any_word
'(' IDENTIFIER
',' nonnull_exprlist
')'
2147 { $$
= build_tree_list
($1, tree_cons
(NULL_TREE
, $3, $5)); }
2148 | any_word
'(' nonnull_exprlist
')'
2149 { $$
= build_tree_list
($1, $3); }
2152 /* This still leaves out most reserved keywords,
2153 shouldn't we include them? */
2162 /* A nonempty list of identifiers, including typenames. */
2163 identifiers_or_typenames:
2165 { $$
= build_tree_list
(NULL_TREE
, $1); }
2166 | identifiers_or_typenames
',' identifier
2167 { $$
= chainon
($1, build_tree_list
(NULL_TREE
, $3)); }
2171 /* empty */ %prec EMPTY
2176 /* If we are processing a template, we don't want to expand this
2180 expr_no_commas %prec
'='
2182 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, NULL_TREE
);
2183 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2185 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2186 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2187 |
'{' initlist
',' '}'
2188 { $$
= build_nt
(CONSTRUCTOR
, NULL_TREE
, nreverse
($2));
2189 TREE_HAS_CONSTRUCTOR
($$
) = 1; }
2194 /* This chain is built in reverse order,
2195 and put in forward order where initlist is used. */
2198 { $$
= build_tree_list
(NULL_TREE
, $$
); }
2200 { $$
= tree_cons
(NULL_TREE
, $3, $$
); }
2201 /* These are for labeled elements. */
2202 |
'[' expr_no_commas
']' init
2203 { $$
= build_tree_list
($2, $4); }
2204 | identifier
':' init
2205 { $$
= build_tree_list
($$
, $3); }
2206 | initlist
',' identifier
':' init
2207 { $$
= tree_cons
($3, $5, $$
); }
2211 PRE_PARSED_FUNCTION_DECL maybe_return_init ctor_initializer_opt compstmt_or_error
2213 expand_body
(finish_function
((int)$3 |
2));
2214 process_next_inline
($1);
2216 | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block
2218 expand_body
(finish_function
((int)$3 |
2));
2219 process_next_inline
($1);
2221 | PRE_PARSED_FUNCTION_DECL maybe_return_init
error
2223 finish_function
(2);
2224 process_next_inline
($1); }
2229 | pending_inlines pending_inline eat_saved_input
2232 /* A regurgitated default argument. The value of DEFARG_MARKER will be
2233 the TREE_LIST node for the parameter in question. */
2235 DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
2236 { replace_defarg
($1, $2); }
2237 | DEFARG_MARKER
error END_OF_SAVED_INPUT
2238 { replace_defarg
($1, error_mark_node
); }
2241 /* empty */ %prec EMPTY
2242 | pending_defargs defarg_again
2243 { do_pending_defargs
(); }
2244 | pending_defargs
error
2245 { do_pending_defargs
(); }
2250 { $
<ttype
>$
= current_enum_type
;
2251 current_enum_type
= start_enum
($2); }
2253 { $$.t
= current_enum_type
;
2254 finish_enum
(current_enum_type
);
2255 $$.new_type_flag
= 1;
2256 current_enum_type
= $
<ttype
>4;
2257 check_for_missing_semicolon
($$.t
); }
2259 { $
<ttype
>$
= current_enum_type
;
2260 current_enum_type
= start_enum
(make_anon_name
()); }
2262 { $$.t
= current_enum_type
;
2263 finish_enum
(current_enum_type
);
2264 $$.new_type_flag
= 1;
2265 current_enum_type
= $
<ttype
>3;
2266 check_for_missing_semicolon
($$.t
); }
2268 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2269 $$.new_type_flag
= 0; }
2270 | ENUM complex_type_name
2271 { $$.t
= xref_tag
(enum_type_node
, $2, 1);
2272 $$.new_type_flag
= 0; }
2273 | TYPENAME_KEYWORD typename_sub
2275 $$.new_type_flag
= 0;
2276 if
(!processing_template_decl
)
2277 cp_pedwarn
("using `typename' outside of template"); }
2278 /* C++ extensions, merged with C to avoid shift/reduce conflicts */
2280 { $1.t
= begin_class_definition
($1.t
);
2281 current_aggr
= NULL_TREE
; }
2282 opt.component_decl_list
'}' maybe_attribute
2287 if
(yychar == YYEMPTY
)
2289 semi
= yychar == ';';
2291 t
= finish_class_definition
($1.t
, $6, semi
,
2295 /* restore current_aggr */
2296 current_aggr
= TREE_CODE
(t
) != RECORD_TYPE
2298 : CLASSTYPE_DECLARED_CLASS
(t
)
2299 ? class_type_node
: record_type_node
;
2303 done_pending_defargs
();
2304 begin_inline_definitions
();
2308 finish_inline_definitions
();
2310 $$.new_type_flag
= 1;
2312 | class_head %prec EMPTY
2314 if
($1.new_type_flag
&& $1.t
!= error_mark_node
)
2315 pop_scope
(CP_DECL_CONTEXT
(TYPE_MAIN_DECL
($1.t
)));
2316 $$.new_type_flag
= 0;
2317 if
($1.t
== error_mark_node
)
2319 else if
(TYPE_BINFO
($1.t
) == NULL_TREE
)
2321 cp_error
("%T is not a class type", $1.t
);
2322 $$.t
= error_mark_node
;
2327 /* struct B: public A; is not accepted by the standard grammar. */
2328 if
(CLASS_TYPE_P
($$.t
)
2329 && TYPE_BINFO_BASETYPES
($$.t
)
2330 && !COMPLETE_TYPE_P
($$.t
)
2331 && ! TYPE_BEING_DEFINED
($$.t
))
2332 cp_error
("base clause without member specification for `%#T'",
2346 { if
(pedantic
&& !in_system_header
)
2347 pedwarn
("comma at end of enumerator list"); }
2353 { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2355 { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2357 { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER
($2)); }
2359 { error ("no body nor ';' separates two class, struct or union declarations"); }
2361 { $$
= build_tree_list
($2, $1); }
2364 named_class_head_sans_basetype:
2372 named_class_head_sans_basetype_defn:
2373 aggr identifier_defn %prec EMPTY
2374 { current_aggr
= $$
; $$
= $2; }
2375 | named_class_head_sans_basetype
'{'
2376 { yyungetc
('{', 1); }
2377 | named_class_head_sans_basetype
':'
2378 { yyungetc
(':', 1); }
2381 named_complex_class_head_sans_basetype:
2382 aggr nested_name_specifier identifier
2385 $$.t
= handle_class_head
($1, $2, $3);
2386 $$.new_type_flag
= 1;
2388 | aggr global_scope nested_name_specifier identifier
2391 $$.t
= handle_class_head
($1, $3, $4);
2392 $$.new_type_flag
= 1;
2394 | aggr global_scope identifier
2397 $$.t
= handle_class_head
($1, NULL_TREE
, $3);
2398 $$.new_type_flag
= 1;
2400 | aggr apparent_template_type
2404 $$.new_type_flag
= 0;
2406 | aggr nested_name_specifier apparent_template_type
2410 push_scope
(CP_DECL_CONTEXT
($$.t
));
2411 $$.new_type_flag
= 1;
2413 | aggr global_scope nested_name_specifier apparent_template_type
2417 push_scope
(CP_DECL_CONTEXT
($$.t
));
2418 $$.new_type_flag
= 1;
2423 named_class_head_sans_basetype %prec EMPTY
2425 $$.t
= xref_tag
(current_aggr
, $1, 1);
2426 $$.new_type_flag
= 0;
2428 | named_class_head_sans_basetype_defn
2429 { $
<ttype
>$
= xref_tag
(current_aggr
, $1, 0); }
2430 /* Class name is unqualified, so we look for base classes
2431 in the current scope. */
2432 maybe_base_class_list %prec EMPTY
2435 $$.new_type_flag
= 0;
2437 xref_basetypes
(current_aggr
, $1, $
<ttype
>2, $3);
2439 | named_complex_class_head_sans_basetype
2440 maybe_base_class_list
2442 if
($1.t
!= error_mark_node
)
2444 tree type
= TREE_TYPE
($1.t
);
2447 $$.new_type_flag
= $1.new_type_flag
;
2448 if
((current_aggr
== union_type_node
)
2449 != (TREE_CODE
(type
) == UNION_TYPE
))
2450 cp_pedwarn
(current_aggr
== union_type_node
2451 ?
"`union' tag used in declaring `%#T'"
2452 : "non-`union' tag used in declaring `%#T'",
2454 else if
(TREE_CODE
(type
) == RECORD_TYPE
)
2455 /* We might be specializing a template with a different
2457 CLASSTYPE_DECLARED_CLASS
(type
)
2458 = (current_aggr
== class_type_node
);
2461 if
(TREE_CODE
(type
) == TYPENAME_TYPE
)
2462 /* In a definition of a member class template, we
2463 will get here with an implicit typename, a
2464 TYPENAME_TYPE with a type. */
2465 type
= TREE_TYPE
(type
);
2466 maybe_process_partial_specialization
(type
);
2467 xref_basetypes
(current_aggr
, $1.t
, type
, $2);
2475 { $$
= xref_tag
($$
, make_anon_name
(), 0);
2476 yyungetc
('{', 1); }
2479 /* The tree output of this nonterminal a declarationf or the type
2480 named. If NEW_TYPE_FLAG is set, then the name used in this
2481 class-head was explicitly qualified, e.g.: `struct X::Y'. We have
2482 already called push_scope for X. */
2487 $$.new_type_flag
= 0;
2492 maybe_base_class_list:
2493 /* empty */ %prec EMPTY
2495 |
':' see_typename %prec EMPTY
2496 { yyungetc
(':', 1); $$
= NULL_TREE
; }
2497 |
':' see_typename base_class_list %prec EMPTY
2503 | base_class_list
',' see_typename base_class
2504 { $$
= chainon
($$
, $4); }
2509 { $$
= finish_base_specifier
(access_default_node
, $1); }
2510 | base_class_access_list see_typename base_class
.1
2511 { $$
= finish_base_specifier
($1, $3); }
2517 $$
= error_mark_node
; }
2519 { $$
= TREE_TYPE
($$
); }
2522 base_class_access_list:
2523 VISSPEC see_typename
2524 | SCSPEC see_typename
2525 { if
($1 != ridpointers
[(int)RID_VIRTUAL
])
2526 cp_error
("`%D' access", $1);
2527 $$
= access_default_virtual_node
; }
2528 | base_class_access_list VISSPEC see_typename
2530 if
($1 != access_default_virtual_node
)
2531 error ("multiple access specifiers");
2532 else if
($2 == access_public_node
)
2533 $$
= access_public_virtual_node
;
2534 else if
($2 == access_protected_node
)
2535 $$
= access_protected_virtual_node
;
2536 else
/* $2 == access_private_node */
2537 $$
= access_private_virtual_node
;
2539 | base_class_access_list SCSPEC see_typename
2540 { if
($2 != ridpointers
[(int)RID_VIRTUAL
])
2541 cp_error
("`%D' access", $2);
2542 else if
($$
== access_public_node
)
2543 $$
= access_public_virtual_node
;
2544 else if
($$
== access_protected_node
)
2545 $$
= access_protected_virtual_node
;
2546 else if
($$
== access_private_node
)
2547 $$
= access_private_virtual_node
;
2549 error ("multiple `virtual' specifiers");
2553 opt.component_decl_list
:
2554 | component_decl_list
2555 | opt.component_decl_list access_specifier component_decl_list
2556 | opt.component_decl_list access_specifier
2562 current_access_specifier
= $1;
2566 /* Note: we no longer warn about the semicolon after a component_decl_list.
2567 ARM $9.2 says that the semicolon is optional, and therefore allowed. */
2568 component_decl_list:
2571 finish_member_declaration
($1);
2572 current_aggr
= NULL_TREE
;
2573 reset_type_access_control
();
2575 | component_decl_list component_decl
2577 finish_member_declaration
($2);
2578 current_aggr
= NULL_TREE
;
2579 reset_type_access_control
();
2584 component_decl_1
';'
2585 | component_decl_1
'}'
2586 { error ("missing ';' before right brace");
2587 yyungetc
('}', 0); }
2588 /* C++: handle constructors, destructors and inline functions */
2589 /* note that INLINE is like a TYPESPEC */
2590 | fn.def2
':' /* base_init compstmt */
2591 { $$
= finish_method
($$
); }
2592 | fn.def2 TRY
/* base_init compstmt */
2593 { $$
= finish_method
($$
); }
2594 | fn.def2 RETURN_KEYWORD
/* base_init compstmt */
2595 { $$
= finish_method
($$
); }
2596 | fn.def2
'{' /* nodecls compstmt */
2597 { $$
= finish_method
($$
); }
2600 | extension component_decl
2603 | template_header component_decl
2606 $$
= finish_member_template_decl
($2);
2608 /* The component was already processed. */
2611 finish_template_decl
($1);
2613 | template_header typed_declspecs
';'
2615 $$
= finish_member_class_template
($2.t
);
2616 finish_template_decl
($1);
2623 /* Do not add a "typed_declspecs declarator" rule here for
2624 speed; we need to call grok_x_components for enums, so the
2625 speedup would be insignificant. */
2626 typed_declspecs components
2628 /* Most of the productions for component_decl only
2629 allow the creation of one new member, so we call
2630 finish_member_declaration in component_decl_list.
2631 For this rule and the next, however, there can be
2632 more than one member, e.g.:
2636 and we need the first member to be fully
2637 registered before the second is processed.
2638 Therefore, the rules for components take care of
2639 this processing. To avoid registering the
2640 components more than once, we send NULL_TREE up
2641 here; that lets finish_member_declaration know
2642 that there is nothing to do. */
2644 grok_x_components
($1.t
);
2647 | declmods notype_components
2650 grok_x_components
($1.t
);
2653 | notype_declarator maybeasm maybe_attribute maybe_init
2654 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2655 | constructor_declarator maybeasm maybe_attribute maybe_init
2656 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2657 |
':' expr_no_commas
2658 { $$
= grokbitfield
(NULL_TREE
, NULL_TREE
, $2); }
2662 /* These rules introduce a reduce/reduce conflict; in
2663 typedef int foo, bar;
2667 should "A::foo" be declared as a function or "A::bar" as a data
2668 member? In other words, is "bar" an after_type_declarator or a
2670 | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init
2671 { tree specs
, attrs
;
2672 split_specs_attrs
($1.t
, &specs
, &attrs
);
2673 $$
= grokfield
($2, specs
, $5, $3,
2674 chainon
($4, attrs
)); }
2675 | component_constructor_declarator maybeasm maybe_attribute maybe_init
2676 { $$
= grokfield
($$
, NULL_TREE
, $4, $2, $3); }
2678 { $$
= do_class_using_decl
($1); }
2680 /* The case of exactly one component is handled directly by component_decl. */
2683 /* empty: possibly anonymous */
2685 | component_declarator0
2687 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2688 $1 = finish_member_template_decl
($1);
2689 finish_member_declaration
($1);
2692 | components
',' component_declarator
2694 check_multiple_declarators
();
2695 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2696 $3 = finish_member_template_decl
($3);
2697 finish_member_declaration
($3);
2703 /* empty: possibly anonymous */
2705 | notype_component_declarator0
2707 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2708 $1 = finish_member_template_decl
($1);
2709 finish_member_declaration
($1);
2712 | notype_components
',' notype_component_declarator
2714 check_multiple_declarators
();
2715 if
(PROCESSING_REAL_TEMPLATE_DECL_P
())
2716 $3 = finish_member_template_decl
($3);
2717 finish_member_declaration
($3);
2722 component_declarator0:
2723 after_type_component_declarator0
2724 | notype_component_declarator0
2727 component_declarator:
2728 after_type_component_declarator
2729 | notype_component_declarator
2732 after_type_component_declarator0:
2733 after_type_declarator maybeasm maybe_attribute maybe_init
2734 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2736 | TYPENAME
':' expr_no_commas maybe_attribute
2737 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2741 notype_component_declarator0:
2742 notype_declarator maybeasm maybe_attribute maybe_init
2743 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2745 | constructor_declarator maybeasm maybe_attribute maybe_init
2746 { $$
= parse_field0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2748 | IDENTIFIER
':' expr_no_commas maybe_attribute
2749 { $$
= parse_bitfield0
($1, $
<ftype
>0.t
, $
<ftype
>0.lookups
,
2751 |
':' expr_no_commas maybe_attribute
2752 { $$
= parse_bitfield0
(NULL_TREE
, $
<ftype
>0.t
,
2753 $
<ftype
>0.lookups
, $3, $2); }
2756 after_type_component_declarator:
2757 after_type_declarator maybeasm maybe_attribute maybe_init
2758 { $$
= parse_field
($1, $3, $2, $4); }
2759 | TYPENAME
':' expr_no_commas maybe_attribute
2760 { $$
= parse_bitfield
($1, $4, $3); }
2763 notype_component_declarator:
2764 notype_declarator maybeasm maybe_attribute maybe_init
2765 { $$
= parse_field
($1, $3, $2, $4); }
2766 | IDENTIFIER
':' expr_no_commas maybe_attribute
2767 { $$
= parse_bitfield
($1, $4, $3); }
2768 |
':' expr_no_commas maybe_attribute
2769 { $$
= parse_bitfield
(NULL_TREE
, $3, $2); }
2773 enumlist maybecomma_warn
2777 /* We chain the enumerators in reverse order.
2778 Because of the way enums are built, the order is
2779 insignificant. Take advantage of this fact. */
2783 | enumlist
',' enumerator
2788 { build_enumerator
($1, NULL_TREE
, current_enum_type
); }
2789 | identifier
'=' expr_no_commas
2790 { build_enumerator
($1, $3, current_enum_type
); }
2793 /* ISO new-type-id (5.3.4) */
2795 type_specifier_seq new_declarator
2796 { $$.t
= build_tree_list
($1.t
, $2);
2797 $$.new_type_flag
= $1.new_type_flag
; }
2798 | type_specifier_seq %prec EMPTY
2799 { $$.t
= build_tree_list
($1.t
, NULL_TREE
);
2800 $$.new_type_flag
= $1.new_type_flag
; }
2801 /* GNU extension to allow arrays of arbitrary types with
2802 non-constant dimension. */
2803 |
'(' type_id
')' '[' expr
']'
2806 pedwarn
("ISO C++ forbids array dimensions with parenthesized type in new");
2807 $$.t
= build_nt
(ARRAY_REF
, TREE_VALUE
($2.t
), $5);
2808 $$.t
= build_tree_list
(TREE_PURPOSE
($2.t
), $$.t
);
2809 $$.new_type_flag
= $2.new_type_flag
;
2814 /* empty */ %prec EMPTY
2816 | cv_qualifiers CV_QUALIFIER
2817 { $$
= tree_cons
(NULL_TREE
, $2, $$
); }
2820 nonempty_cv_qualifiers:
2822 { $$.t
= hash_tree_cons
(NULL_TREE
, $1, NULL_TREE
);
2823 $$.new_type_flag
= 0; }
2824 | nonempty_cv_qualifiers CV_QUALIFIER
2825 { $$.t
= hash_tree_cons
(NULL_TREE
, $2, $1.t
);
2826 $$.new_type_flag
= $1.new_type_flag
; }
2829 /* These rules must follow the rules for function declarations
2830 and component declarations. That way, longer rules are preferred. */
2832 /* An expression which will not live on the momentary obstack. */
2834 '(' nonnull_exprlist
')'
2839 { $$
= empty_parms
(); }
2844 /* A declarator that is allowed only after an explicit typespec. */
2846 after_type_declarator_intern:
2847 after_type_declarator
2848 | attributes after_type_declarator
2850 /* Provide support for '(' attributes '*' declarator ')'
2852 $$
= tree_cons
($1, $2, NULL_TREE
);
2856 /* may all be followed by prec '.' */
2857 after_type_declarator:
2858 '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2859 { $$
= make_pointer_declarator
($2.t
, $3); }
2860 |
'&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY
2861 { $$
= make_reference_declarator
($2.t
, $3); }
2862 |
'*' after_type_declarator_intern %prec UNARY
2863 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2864 |
'&' after_type_declarator_intern %prec UNARY
2865 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2866 | ptr_to_mem cv_qualifiers after_type_declarator_intern
2867 { tree arg
= make_pointer_declarator
($2, $3);
2868 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2870 | direct_after_type_declarator
2873 direct_after_type_declarator:
2874 direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
2875 { $$
= make_call_declarator
($$
, $2, $3, $4); }
2876 | direct_after_type_declarator
'[' expr
']'
2877 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
2878 | direct_after_type_declarator
'[' ']'
2879 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
2880 |
'(' after_type_declarator_intern
')'
2882 | nested_name_specifier type_name %prec EMPTY
2883 { push_nested_class
($1, 3);
2884 $$
= build_nt
(SCOPE_REF
, $$
, $2);
2885 TREE_COMPLEXITY
($$
) = current_class_depth
; }
2886 | type_name %prec EMPTY
2890 type_name %prec EMPTY
2892 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
2894 $$
= lookup_name
($1, 1);
2895 maybe_note_name_used_in_class
($1, $$
);
2900 | global_scope type_name
2902 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
2903 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
2906 got_scope
= NULL_TREE
;
2913 | global_scope nested_type
2918 nested_name_specifier type_name %prec EMPTY
2919 { $$
= get_type_decl
($2); }
2922 /* A declarator allowed whether or not there has been
2923 an explicit typespec. These cannot redeclare a typedef-name. */
2925 notype_declarator_intern:
2927 | attributes notype_declarator
2929 /* Provide support for '(' attributes '*' declarator ')'
2931 $$
= tree_cons
($1, $2, NULL_TREE
);
2936 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2937 { $$
= make_pointer_declarator
($2.t
, $3); }
2938 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2939 { $$
= make_reference_declarator
($2.t
, $3); }
2940 |
'*' notype_declarator_intern %prec UNARY
2941 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2942 |
'&' notype_declarator_intern %prec UNARY
2943 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2944 | ptr_to_mem cv_qualifiers notype_declarator_intern
2945 { tree arg
= make_pointer_declarator
($2, $3);
2946 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2948 | direct_notype_declarator
2951 complex_notype_declarator:
2952 '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2953 { $$
= make_pointer_declarator
($2.t
, $3); }
2954 |
'&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY
2955 { $$
= make_reference_declarator
($2.t
, $3); }
2956 |
'*' complex_notype_declarator %prec UNARY
2957 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
2958 |
'&' complex_notype_declarator %prec UNARY
2959 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
2960 | ptr_to_mem cv_qualifiers notype_declarator_intern
2961 { tree arg
= make_pointer_declarator
($2, $3);
2962 $$
= build_nt
(SCOPE_REF
, $1, arg
);
2964 | complex_direct_notype_declarator
2967 complex_direct_notype_declarator:
2968 direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec
'.'
2969 { $$
= make_call_declarator
($$
, $2, $3, $4); }
2970 |
'(' complex_notype_declarator
')'
2972 | direct_notype_declarator
'[' expr
']'
2973 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
2974 | direct_notype_declarator
'[' ']'
2975 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
2976 | notype_qualified_id
2977 { enter_scope_of
($1); }
2978 | global_scope notype_qualified_id
2979 { enter_scope_of
($2); $$
= $2;}
2980 | global_scope notype_unqualified_id
2981 { $$
= build_nt
(SCOPE_REF
, global_namespace
, $2);
2982 enter_scope_of
($$
);
2984 | nested_name_specifier notype_template_declarator
2985 { got_scope
= NULL_TREE
;
2986 $$
= build_nt
(SCOPE_REF
, $1, $2);
2987 enter_scope_of
($$
);
2992 nested_name_specifier unqualified_id
2993 { got_scope
= NULL_TREE
;
2994 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
2995 | nested_name_specifier object_template_id
2996 { got_scope
= NULL_TREE
;
2997 $$
= build_nt
(SCOPE_REF
, $1, $2); }
3000 notype_qualified_id:
3001 nested_name_specifier notype_unqualified_id
3002 { got_scope
= NULL_TREE
;
3003 $$
= build_nt
(SCOPE_REF
, $$
, $2); }
3004 | nested_name_specifier object_template_id
3005 { got_scope
= NULL_TREE
;
3006 $$
= build_nt
(SCOPE_REF
, $1, $2); }
3011 | global_scope notype_qualified_id
3016 typespec
'(' nonnull_exprlist
')'
3017 { $$
= build_functional_cast
($1.t
, $3); }
3018 | typespec
'(' expr_or_declarator_intern
')'
3019 { $$
= reparse_decl_as_expr
($1.t
, $3); }
3020 | typespec fcast_or_absdcl %prec EMPTY
3021 { $$
= reparse_absdcl_as_expr
($1.t
, $2); }
3027 | template_type %prec EMPTY
3030 nested_name_specifier:
3031 nested_name_specifier_1
3032 | nested_name_specifier nested_name_specifier_1
3034 | nested_name_specifier TEMPLATE explicit_template_type SCOPE
3036 = make_typename_type
($1, $3, /*complain=*/1); }
3037 /* Error handling per Core 125. */
3038 | nested_name_specifier IDENTIFIER SCOPE
3040 = make_typename_type
($1, $2, /*complain=*/1); }
3041 | nested_name_specifier PTYPENAME SCOPE
3043 = make_typename_type
($1, $2, /*complain=*/1); }
3046 /* Why the @#$%^& do type_name and notype_identifier need to be expanded
3047 inline here?!? (jason) */
3048 nested_name_specifier_1:
3051 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3054 maybe_note_name_used_in_class
($1, $$
);
3057 complete_type
(TYPE_MAIN_VARIANT
(TREE_TYPE
($$
)));
3061 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3063 got_scope
= $$
= TREE_TYPE
($$
);
3067 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3071 | template_type SCOPE
3072 { got_scope
= $$
= complete_type
(TREE_TYPE
($1)); }
3077 | global_scope typename_sub0
3082 typename_sub1 identifier %prec EMPTY
3085 $$
= make_typename_type
($1, $2, /*complain=*/1);
3086 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3087 cp_error
("`%T' is not a class or namespace", $2);
3091 if
(TREE_CODE
($$
) == TYPE_DECL
)
3092 $$
= TREE_TYPE
($$
);
3095 | typename_sub1 template_type %prec EMPTY
3096 { $$
= TREE_TYPE
($2); }
3097 | typename_sub1 explicit_template_type %prec EMPTY
3098 { $$
= make_typename_type
($1, $2, /*complain=*/1); }
3099 | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY
3100 { $$
= make_typename_type
($1, $3, /*complain=*/1); }
3106 if
(TREE_CODE
($1) == IDENTIFIER_NODE
)
3107 cp_error
("`%T' is not a class or namespace", $1);
3108 else if
(TREE_CODE
($1) == TYPE_DECL
)
3109 $$
= TREE_TYPE
($1);
3111 | typename_sub1 typename_sub2
3114 $$
= make_typename_type
($1, $2, /*complain=*/1);
3115 else if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3116 cp_error
("`%T' is not a class or namespace", $2);
3120 if
(TREE_CODE
($$
) == TYPE_DECL
)
3121 $$
= TREE_TYPE
($$
);
3124 | typename_sub1 explicit_template_type SCOPE
3126 = make_typename_type
($1, $2, /*complain=*/1); }
3127 | typename_sub1 TEMPLATE explicit_template_type SCOPE
3129 = make_typename_type
($1, $3, /*complain=*/1); }
3132 /* This needs to return a TYPE_DECL for simple names so that we don't
3133 forget what name was used. */
3137 if
(TREE_CODE
($1) != TYPE_DECL
)
3140 /* Retrieve the type for the identifier, which might involve
3141 some computation. */
3142 got_scope
= complete_type
(TREE_TYPE
($$
));
3144 if
($$
== error_mark_node
)
3145 cp_error
("`%T' is not a class or namespace", $1);
3149 if
(TREE_CODE
($1) != TYPE_DECL
)
3151 got_scope
= complete_type
(TREE_TYPE
($$
));
3153 | template_type SCOPE
3154 { got_scope
= $$
= complete_type
(TREE_TYPE
($$
)); }
3159 if
(TREE_CODE
($$
) == IDENTIFIER_NODE
)
3165 explicit_template_type:
3166 identifier
'<' template_arg_list_opt template_close_bracket
3167 { $$
= build_min_nt
(TEMPLATE_ID_EXPR
, $1, $3); }
3171 global_scope type_name
3173 if
(TREE_CODE
($2) == IDENTIFIER_NODE
)
3174 $$
= IDENTIFIER_GLOBAL_VALUE
($2);
3177 got_scope
= NULL_TREE
;
3180 | global_scope nested_type
3185 nested_name_specifier
'*'
3186 { got_scope
= NULL_TREE
; }
3187 | global_scope nested_name_specifier
'*'
3188 { $$
= $2; got_scope
= NULL_TREE
; }
3191 /* All uses of explicit global scope must go through this nonterminal so
3192 that got_scope will be set before yylex is called to get the next token. */
3195 { got_scope
= void_type_node
; }
3198 /* ISO new-declarator (5.3.4) */
3200 '*' cv_qualifiers new_declarator
3201 { $$
= make_pointer_declarator
($2, $3); }
3202 |
'*' cv_qualifiers %prec EMPTY
3203 { $$
= make_pointer_declarator
($2, NULL_TREE
); }
3204 |
'&' cv_qualifiers new_declarator %prec EMPTY
3205 { $$
= make_reference_declarator
($2, $3); }
3206 |
'&' cv_qualifiers %prec EMPTY
3207 { $$
= make_reference_declarator
($2, NULL_TREE
); }
3208 | ptr_to_mem cv_qualifiers %prec EMPTY
3209 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3210 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3212 | ptr_to_mem cv_qualifiers new_declarator
3213 { tree arg
= make_pointer_declarator
($2, $3);
3214 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3216 | direct_new_declarator %prec EMPTY
3219 /* ISO direct-new-declarator (5.3.4) */
3220 direct_new_declarator:
3222 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3223 | direct_new_declarator
'[' expr
']'
3224 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3231 /* Provide support for '(' attributes '*' declarator ')'
3233 $$
= tree_cons
($1, $2, NULL_TREE
);
3237 /* ISO abstract-declarator (8.1) */
3239 '*' nonempty_cv_qualifiers absdcl_intern
3240 { $$
= make_pointer_declarator
($2.t
, $3); }
3242 { $$
= make_pointer_declarator
(NULL_TREE
, $2); }
3243 |
'*' nonempty_cv_qualifiers %prec EMPTY
3244 { $$
= make_pointer_declarator
($2.t
, NULL_TREE
); }
3246 { $$
= make_pointer_declarator
(NULL_TREE
, NULL_TREE
); }
3247 |
'&' nonempty_cv_qualifiers absdcl_intern
3248 { $$
= make_reference_declarator
($2.t
, $3); }
3250 { $$
= make_reference_declarator
(NULL_TREE
, $2); }
3251 |
'&' nonempty_cv_qualifiers %prec EMPTY
3252 { $$
= make_reference_declarator
($2.t
, NULL_TREE
); }
3254 { $$
= make_reference_declarator
(NULL_TREE
, NULL_TREE
); }
3255 | ptr_to_mem cv_qualifiers %prec EMPTY
3256 { tree arg
= make_pointer_declarator
($2, NULL_TREE
);
3257 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3259 | ptr_to_mem cv_qualifiers absdcl_intern
3260 { tree arg
= make_pointer_declarator
($2, $3);
3261 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3263 | direct_abstract_declarator %prec EMPTY
3266 /* ISO direct-abstract-declarator (8.1) */
3267 direct_abstract_declarator:
3268 '(' absdcl_intern
')'
3270 /* `(typedef)1' is `int'. */
3271 | direct_abstract_declarator
'(' parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3272 { $$
= make_call_declarator
($$
, $3, $5, $6); }
3273 | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec
'.'
3274 { $$
= make_call_declarator
($$
, empty_parms
(), $3, $4); }
3275 | direct_abstract_declarator
'[' expr
']' %prec
'.'
3276 { $$
= build_nt
(ARRAY_REF
, $$
, $3); }
3277 | direct_abstract_declarator
'[' ']' %prec
'.'
3278 { $$
= build_nt
(ARRAY_REF
, $$
, NULL_TREE
); }
3279 |
'(' complex_parmlist
')' cv_qualifiers exception_specification_opt %prec
'.'
3280 { $$
= make_call_declarator
(NULL_TREE
, $2, $4, $5); }
3281 | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3282 { set_quals_and_spec
($$
, $2, $3); }
3283 | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec
'.'
3284 { set_quals_and_spec
($$
, $2, $3); }
3285 |
'[' expr
']' %prec
'.'
3286 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, $2); }
3288 { $$
= build_nt
(ARRAY_REF
, NULL_TREE
, NULL_TREE
); }
3291 /* For C++, decls and stmts can be intermixed, so we don't need to
3292 have a special rule that won't start parsing the stmt section
3293 until we have a stmt that parses without errors. */
3306 /* Read zero or more forward-declarations for labels
3307 that nested functions can jump to. */
3312 pedwarn
("ISO C++ forbids label declarations"); }
3317 | label_decls label_decl
3321 LABEL identifiers_or_typenames
';'
3325 finish_label_decl
(TREE_VALUE
($2));
3326 $2 = TREE_CHAIN
($2);
3331 /* This is the body of a function definition.
3332 It causes syntax errors to ignore to the next openbrace. */
3340 { $
<ttype
>$
= begin_compound_stmt
(0); }
3342 { STMT_LINENO
($
<ttype
>3) = $1;
3343 finish_compound_stmt
(0, $
<ttype
>3); }
3348 { $
<ttype
>$
= begin_if_stmt
();
3349 cond_stmt_keyword
= "if"; }
3351 { finish_if_stmt_cond
($3, $
<ttype
>2); }
3352 implicitly_scoped_stmt
3354 finish_then_clause
($
<ttype
>2); }
3357 implicitly_scoped_stmt:
3360 { $
<ttype
>$
= begin_compound_stmt
(0); }
3361 save_lineno simple_stmt
3362 { STMT_LINENO
($
<ttype
>1) = $2;
3363 if
($3) STMT_LINENO
($3) = $2;
3364 finish_compound_stmt
(0, $
<ttype
>1); }
3369 | save_lineno simple_stmt
3370 { if
($2) STMT_LINENO
($2) = $1; }
3378 { $$
= finish_expr_stmt
($1); }
3380 { begin_else_clause
(); }
3381 implicitly_scoped_stmt
3384 finish_else_clause
($1);
3387 | simple_if %prec IF
3389 finish_if_stmt
(); }
3392 $
<ttype
>$
= begin_while_stmt
();
3393 cond_stmt_keyword
= "while";
3396 { finish_while_stmt_cond
($3, $
<ttype
>2); }
3397 implicitly_scoped_stmt
3399 finish_while_stmt
($
<ttype
>2); }
3401 { $
<ttype
>$
= begin_do_stmt
(); }
3402 implicitly_scoped_stmt WHILE
3404 finish_do_body
($
<ttype
>2);
3405 cond_stmt_keyword
= "do";
3407 paren_expr_or_null
';'
3409 finish_do_stmt
($6, $
<ttype
>2); }
3411 { $
<ttype
>$
= begin_for_stmt
(); }
3412 '(' for.init.statement
3413 { finish_for_init_stmt
($
<ttype
>2); }
3415 { finish_for_cond
($6, $
<ttype
>2); }
3417 { finish_for_expr
($9, $
<ttype
>2); }
3418 implicitly_scoped_stmt
3420 finish_for_stmt
($
<ttype
>2); }
3422 { $
<ttype
>$
= begin_switch_stmt
(); }
3424 { finish_switch_cond
($4, $
<ttype
>2); }
3425 implicitly_scoped_stmt
3427 finish_switch_stmt
($
<ttype
>2); }
3428 | CASE expr_no_commas
':'
3429 { $
<ttype
>$
= finish_case_label
($2, NULL_TREE
); }
3432 | CASE expr_no_commas ELLIPSIS expr_no_commas
':'
3433 { $
<ttype
>$
= finish_case_label
($2, $4); }
3437 { $
<ttype
>$
= finish_case_label
(NULL_TREE
, NULL_TREE
); }
3441 { $$
= finish_break_stmt
(); }
3443 { $$
= finish_continue_stmt
(); }
3444 | RETURN_KEYWORD
';'
3445 { $$
= finish_return_stmt
(NULL_TREE
); }
3446 | RETURN_KEYWORD expr
';'
3447 { $$
= finish_return_stmt
($2); }
3448 | asm_keyword maybe_cv_qualifier
'(' string ')' ';'
3449 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, NULL_TREE
,
3451 ASM_INPUT_P
($$
) = 1; }
3452 /* This is the case with just output operands. */
3453 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
')' ';'
3454 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, NULL_TREE
); }
3455 /* This is the case with input operands as well. */
3456 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
':'
3457 asm_operands
')' ';'
3458 { $$
= finish_asm_stmt
($2, $4, $6, $8, NULL_TREE
); }
3459 | asm_keyword maybe_cv_qualifier
'(' string SCOPE asm_operands
')' ';'
3460 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, NULL_TREE
); }
3461 /* This is the case with clobbered registers as well. */
3462 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands
':'
3463 asm_operands
':' asm_clobbers
')' ';'
3464 { $$
= finish_asm_stmt
($2, $4, $6, $8, $10); }
3465 | asm_keyword maybe_cv_qualifier
'(' string SCOPE asm_operands
':'
3466 asm_clobbers
')' ';'
3467 { $$
= finish_asm_stmt
($2, $4, NULL_TREE
, $6, $8); }
3468 | asm_keyword maybe_cv_qualifier
'(' string ':' asm_operands SCOPE
3469 asm_clobbers
')' ';'
3470 { $$
= finish_asm_stmt
($2, $4, $6, NULL_TREE
, $8); }
3474 pedwarn
("ISO C++ forbids computed gotos");
3475 $$
= finish_goto_stmt
($3);
3477 | GOTO identifier
';'
3478 { $$
= finish_goto_stmt
($2); }
3482 { error ("label must be followed by statement");
3492 | namespace_using_decl
3493 { do_local_using_decl
($1);
3501 { $
<ttype
>$
= begin_function_try_block
(); }
3502 ctor_initializer_opt compstmt
3503 { finish_function_try_block
($
<ttype
>2); }
3506 finish_function_handler_sequence
($
<ttype
>2);
3513 { $
<ttype
>$
= begin_try_block
(); }
3515 { finish_try_block
($
<ttype
>2); }
3517 { finish_handler_sequence
($
<ttype
>2); }
3522 | handler_seq handler
3527 { $
<ttype
>$
= begin_handler
(); }
3529 { finish_handler_parms
($3, $
<ttype
>2); }
3531 { finish_handler
($
<ttype
>2); }
3535 typed_typespecs %prec EMPTY
3536 | nonempty_cv_qualifiers %prec EMPTY
3542 /* This doesn't allow reference parameters, the below does.
3543 | '(' type_specifier_seq absdcl ')'
3544 { check_for_new_type ("inside exception declarations", $2);
3545 expand_start_catch_block ($2.t, $3); }
3546 | '(' type_specifier_seq ')'
3547 { check_for_new_type ("inside exception declarations", $2);
3548 expand_start_catch_block ($2.t, NULL_TREE); }
3549 | '(' type_specifier_seq notype_declarator ')'
3550 { check_for_new_type ("inside exception declarations", $2);
3551 expand_start_catch_block ($2.t, $3); }
3552 | '(' typed_typespecs after_type_declarator ')'
3553 { check_for_new_type ("inside exception declarations", $2);
3554 expand_start_catch_block ($2.t, $3); }
3555 This allows reference parameters... */
3558 check_for_new_type
("inside exception declarations", $2);
3559 $$
= start_handler_parms
(TREE_PURPOSE
($2.t
),
3566 { finish_label_stmt
($1); }
3568 { finish_label_stmt
($1); }
3570 { finish_label_stmt
($1); }
3572 { finish_label_stmt
($1); }
3577 { finish_expr_stmt
($1); }
3581 pedwarn
("ISO C++ forbids compound statements inside for initializations");
3585 /* Either a type-qualifier or nothing. First thing in an `asm' statement. */
3601 /* These are the operands other than the first string and colon
3602 in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */
3606 | nonnull_asm_operands
3609 nonnull_asm_operands:
3611 | nonnull_asm_operands
',' asm_operand
3612 { $$
= chainon
($$
, $3); }
3617 { $$
= build_tree_list
(build_tree_list
(NULL_TREE
, $1), $3); }
3618 |
'[' identifier
']' STRING
'(' expr
')'
3619 { $$
= build_tree_list
(build_tree_list
($2, $4), $6); }
3624 { $$
= tree_cons
(NULL_TREE
, combine_strings
($1), NULL_TREE
);}
3625 | asm_clobbers
',' string
3626 { $$
= tree_cons
(NULL_TREE
, combine_strings
($3), $1); }
3629 /* This is what appears inside the parens in a function declarator.
3630 Its value is represented in the format that grokdeclarator expects.
3632 In C++, declaring a function with no parameters
3633 means that that function takes *no* parameters. */
3642 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
, $1.t
), 0);
3643 check_for_new_type
("inside parameter list", $1); }
3646 /* This nonterminal does not include the common sequence '(' type_id ')',
3647 as it is ambiguous and must be disambiguated elsewhere. */
3650 { $$
= finish_parmlist
($$
, 0); }
3651 | parms_comma ELLIPSIS
3652 { $$
= finish_parmlist
($1, 1); }
3653 /* C++ allows an ellipsis without a separating ',' */
3655 { $$
= finish_parmlist
($1, 1); }
3657 { $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3660 { $$
= finish_parmlist
(NULL_TREE
, 1); }
3663 /* This helps us recover from really nasty
3664 parse errors, for example, a missing right
3666 yyerror ("possibly missing ')'");
3667 $$
= finish_parmlist
($1, 0);
3673 /* This helps us recover from really nasty
3674 parse errors, for example, a missing right
3676 yyerror ("possibly missing ')'");
3677 $$
= finish_parmlist
(build_tree_list
(NULL_TREE
,
3684 /* A default argument to a */
3687 { maybe_snarf_defarg
(); }
3697 /* A nonempty list of parameter declarations or type names. */
3700 { check_for_new_type
("in a parameter list", $1);
3701 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3703 { check_for_new_type
("in a parameter list", $1);
3704 $$
= build_tree_list
($2, $1.t
); }
3705 | parms_comma full_parm
3706 { check_for_new_type
("in a parameter list", $2);
3707 $$
= chainon
($$
, $2.t
); }
3708 | parms_comma bad_parm
3709 { $$
= chainon
($$
, build_tree_list
(NULL_TREE
, $2)); }
3710 | parms_comma bad_parm
'=' init
3711 { $$
= chainon
($$
, build_tree_list
($4, $2)); }
3717 { check_for_new_type
("in a parameter list", $1);
3718 $$
= build_tree_list
(NULL_TREE
, $1.t
); }
3721 /* A single parameter declaration or parameter type name,
3722 as found in a parmlist. */
3724 /* Here we expand typed_declspecs inline to avoid mis-parsing of
3725 TYPESPEC IDENTIFIER. */
3726 typed_declspecs1 declarator
3727 { tree specs
= strip_attrs
($1.t
);
3728 $$.new_type_flag
= $1.new_type_flag
;
3729 $$.t
= build_tree_list
(specs
, $2); }
3730 | typed_typespecs declarator
3731 { $$.t
= build_tree_list
($1.t
, $2);
3732 $$.new_type_flag
= $1.new_type_flag
; }
3733 | typespec declarator
3734 { $$.t
= build_tree_list
(build_tree_list
(NULL_TREE
, $1.t
),
3736 $$.new_type_flag
= $1.new_type_flag
; }
3737 | typed_declspecs1 absdcl
3738 { tree specs
= strip_attrs
($1.t
);
3739 $$.t
= build_tree_list
(specs
, $2);
3740 $$.new_type_flag
= $1.new_type_flag
; }
3741 | typed_declspecs1 %prec EMPTY
3742 { tree specs
= strip_attrs
($1.t
);
3743 $$.t
= build_tree_list
(specs
, NULL_TREE
);
3744 $$.new_type_flag
= $1.new_type_flag
; }
3745 | declmods notype_declarator
3746 { tree specs
= strip_attrs
($1.t
);
3747 $$.t
= build_tree_list
(specs
, $2);
3748 $$.new_type_flag
= 0; }
3753 { $$.t
= build_tree_list
(NULL_TREE
, $1.t
);
3754 $$.new_type_flag
= $1.new_type_flag
; }
3756 { $$.t
= build_tree_list
($2, $1.t
);
3757 $$.new_type_flag
= $1.new_type_flag
; }
3766 /* empty */ %prec EMPTY
3767 { see_typename
(); }
3771 /* empty */ %prec EMPTY
3773 error ("type specifier omitted for parameter");
3774 $$
= build_tree_list
(integer_type_node
, NULL_TREE
);
3778 error ("type specifier omitted for parameter");
3779 if
(TREE_CODE
($$
) == SCOPE_REF
3780 && (TREE_CODE
(TREE_OPERAND
($$
, 0)) == TEMPLATE_TYPE_PARM
3781 || TREE_CODE
(TREE_OPERAND
($$
, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM
))
3782 cp_error
(" perhaps you want `typename %E' to make it a type", $$
);
3783 $$
= build_tree_list
(integer_type_node
, $$
);
3788 IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore
';'
3790 cp_error
("'%D' is used as a type, but is not defined as a type.", $1);
3791 $3 = error_mark_node
;
3795 template_arg_list_ignore:
3796 '<' template_arg_list_opt template_close_bracket
3802 '(' nonnull_exprlist
')'
3807 exception_specification_opt:
3808 /* empty */ %prec EMPTY
3810 | THROW
'(' ansi_raise_identifiers
')' %prec EMPTY
3812 | THROW LEFT_RIGHT %prec EMPTY
3813 { $$
= empty_except_spec
; }
3816 ansi_raise_identifier:
3819 check_for_new_type
("exception specifier", $1);
3820 $$
= groktypename
($1.t
);
3824 ansi_raise_identifiers:
3825 ansi_raise_identifier
3826 { $$
= add_exception_specifier
(NULL_TREE
, $1, 1); }
3827 | ansi_raise_identifiers
',' ansi_raise_identifier
3828 { $$
= add_exception_specifier
($1, $3, 1); }
3831 conversion_declarator:
3832 /* empty */ %prec EMPTY
3834 |
'*' cv_qualifiers conversion_declarator
3835 { $$
= make_pointer_declarator
($2, $3); }
3836 |
'&' cv_qualifiers conversion_declarator
3837 { $$
= make_reference_declarator
($2, $3); }
3838 | ptr_to_mem cv_qualifiers conversion_declarator
3839 { tree arg
= make_pointer_declarator
($2, $3);
3840 $$
= build_nt
(SCOPE_REF
, $1, arg
);
3847 saved_scopes
= tree_cons
(got_scope
, got_object
, saved_scopes
);
3848 TREE_LANG_FLAG_0
(saved_scopes
) = looking_for_typename
;
3849 /* We look for conversion-type-id's in both the class and current
3850 scopes, just as for ID in 'ptr->ID::'. */
3851 looking_for_typename
= 1;
3852 got_object
= got_scope
;
3853 got_scope
= NULL_TREE
;
3858 { got_scope
= TREE_PURPOSE
(saved_scopes
);
3859 got_object
= TREE_VALUE
(saved_scopes
);
3860 looking_for_typename
= TREE_LANG_FLAG_0
(saved_scopes
);
3861 saved_scopes
= TREE_CHAIN
(saved_scopes
);
3866 operator
'*' unoperator
3867 { $$
= frob_opname
(ansi_opname
(MULT_EXPR
)); }
3868 | operator
'/' unoperator
3869 { $$
= frob_opname
(ansi_opname
(TRUNC_DIV_EXPR
)); }
3870 | operator
'%' unoperator
3871 { $$
= frob_opname
(ansi_opname
(TRUNC_MOD_EXPR
)); }
3872 | operator
'+' unoperator
3873 { $$
= frob_opname
(ansi_opname
(PLUS_EXPR
)); }
3874 | operator
'-' unoperator
3875 { $$
= frob_opname
(ansi_opname
(MINUS_EXPR
)); }
3876 | operator
'&' unoperator
3877 { $$
= frob_opname
(ansi_opname
(BIT_AND_EXPR
)); }
3878 | operator
'|' unoperator
3879 { $$
= frob_opname
(ansi_opname
(BIT_IOR_EXPR
)); }
3880 | operator
'^' unoperator
3881 { $$
= frob_opname
(ansi_opname
(BIT_XOR_EXPR
)); }
3882 | operator
'~' unoperator
3883 { $$
= frob_opname
(ansi_opname
(BIT_NOT_EXPR
)); }
3884 | operator
',' unoperator
3885 { $$
= frob_opname
(ansi_opname
(COMPOUND_EXPR
)); }
3886 | operator ARITHCOMPARE unoperator
3887 { $$
= frob_opname
(ansi_opname
($2)); }
3888 | operator
'<' unoperator
3889 { $$
= frob_opname
(ansi_opname
(LT_EXPR
)); }
3890 | operator
'>' unoperator
3891 { $$
= frob_opname
(ansi_opname
(GT_EXPR
)); }
3892 | operator EQCOMPARE unoperator
3893 { $$
= frob_opname
(ansi_opname
($2)); }
3894 | operator ASSIGN unoperator
3895 { $$
= frob_opname
(ansi_assopname
($2)); }
3896 | operator
'=' unoperator
3897 { $$
= frob_opname
(ansi_assopname
(NOP_EXPR
)); }
3898 | operator LSHIFT unoperator
3899 { $$
= frob_opname
(ansi_opname
($2)); }
3900 | operator RSHIFT unoperator
3901 { $$
= frob_opname
(ansi_opname
($2)); }
3902 | operator PLUSPLUS unoperator
3903 { $$
= frob_opname
(ansi_opname
(POSTINCREMENT_EXPR
)); }
3904 | operator MINUSMINUS unoperator
3905 { $$
= frob_opname
(ansi_opname
(PREDECREMENT_EXPR
)); }
3906 | operator ANDAND unoperator
3907 { $$
= frob_opname
(ansi_opname
(TRUTH_ANDIF_EXPR
)); }
3908 | operator OROR unoperator
3909 { $$
= frob_opname
(ansi_opname
(TRUTH_ORIF_EXPR
)); }
3910 | operator
'!' unoperator
3911 { $$
= frob_opname
(ansi_opname
(TRUTH_NOT_EXPR
)); }
3912 | operator
'?' ':' unoperator
3913 { $$
= frob_opname
(ansi_opname
(COND_EXPR
)); }
3914 | operator MIN_MAX unoperator
3915 { $$
= frob_opname
(ansi_opname
($2)); }
3916 | operator POINTSAT unoperator %prec EMPTY
3917 { $$
= frob_opname
(ansi_opname
(COMPONENT_REF
)); }
3918 | operator POINTSAT_STAR unoperator %prec EMPTY
3919 { $$
= frob_opname
(ansi_opname
(MEMBER_REF
)); }
3920 | operator LEFT_RIGHT unoperator
3921 { $$
= frob_opname
(ansi_opname
(CALL_EXPR
)); }
3922 | operator
'[' ']' unoperator
3923 { $$
= frob_opname
(ansi_opname
(ARRAY_REF
)); }
3924 | operator NEW unoperator %prec EMPTY
3925 { $$
= frob_opname
(ansi_opname
(NEW_EXPR
)); }
3926 | operator DELETE unoperator %prec EMPTY
3927 { $$
= frob_opname
(ansi_opname
(DELETE_EXPR
)); }
3928 | operator NEW
'[' ']' unoperator
3929 { $$
= frob_opname
(ansi_opname
(VEC_NEW_EXPR
)); }
3930 | operator DELETE
'[' ']' unoperator
3931 { $$
= frob_opname
(ansi_opname
(VEC_DELETE_EXPR
)); }
3932 | operator type_specifier_seq conversion_declarator unoperator
3933 { $$
= frob_opname
(grokoptypename
($2.t
, $3)); }
3934 | operator
error unoperator
3935 { $$
= frob_opname
(ansi_opname
(ERROR_MARK
)); }
3938 /* The forced readahead in here is because we might be at the end of a
3939 line, and lineno won't be bumped until yylex absorbs the first token
3940 on the next line. */
3942 { if
(yychar == YYEMPTY
)
3950 debug_yytranslate
(value
)
3953 return yytname
[YYTRANSLATE
(value
)];