home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / cp / parse.in < prev    next >
Text File  |  1996-06-12  |  114KB  |  3,939 lines

  1. /* YACC parser for C++ syntax.
  2.    Copyright (C) 1988, 1989, 1993, 1994, 1995 Free Software Foundation, Inc.
  3.    Hacked by Michael Tiemann (tiemann@cygnus.com)
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.  */
  21.  
  22.  
  23. /* This grammar is based on the GNU CC grammar.  */
  24.  
  25. /* Note: Bison automatically applies a default action of "$$ = $1" for
  26.    all derivations; this is applied before the explicit action, if one
  27.    is given.  Keep this in mind when reading the actions.  */
  28.  
  29. %{
  30. /* Cause the `yydebug' variable to be defined.  */
  31. #define YYDEBUG 1
  32.  
  33. #include "config.h"
  34.  
  35. #include <stdio.h>
  36. #include <errno.h>
  37.  
  38. #include "tree.h"
  39. #include "input.h"
  40. #include "flags.h"
  41. #include "lex.h"
  42. #include "cp-tree.h"
  43. #include "output.h"
  44.  
  45. /* Since parsers are distinct for each language, put the language string
  46.    definition here.  (fnf) */
  47. char *language_string = "GNU C++";
  48.  
  49. extern tree void_list_node;
  50. extern struct obstack permanent_obstack;
  51.  
  52. #ifndef errno
  53. extern int errno;
  54. #endif
  55.  
  56. extern int end_of_file;
  57. extern int current_class_depth;
  58.  
  59. /* FSF LOCAL dje prefix attributes */
  60. extern tree strip_attrs        PROTO((tree));
  61. /* END FSF LOCAL */
  62.  
  63. void yyerror ();
  64.  
  65. /* Like YYERROR but do call yyerror.  */
  66. #define YYERROR1 { yyerror ("syntax error"); YYERROR; }
  67.  
  68. #define OP0(NODE) (TREE_OPERAND (NODE, 0))
  69. #define OP1(NODE) (TREE_OPERAND (NODE, 1))
  70.  
  71. /* Contains the statement keyword (if/while/do) to include in an
  72.    error message if the user supplies an empty conditional expression.  */
  73. static char *cond_stmt_keyword;
  74.  
  75. /* Nonzero if we have an `extern "C"' acting as an extern specifier.  */
  76. int have_extern_spec;
  77. int used_extern_spec;
  78.  
  79. void yyhook ();
  80.  
  81. /* Cons up an empty parameter list.  */
  82. #ifdef __GNUC__
  83. __inline
  84. #endif
  85. static tree
  86. empty_parms ()
  87. {
  88.   tree parms;
  89.  
  90.   if (strict_prototype)
  91.     parms = void_list_node;
  92.   else
  93.     parms = NULL_TREE;
  94.   return parms;
  95. }
  96. %}
  97.  
  98. %start program
  99.  
  100. %union {long itype; tree ttype; char *strtype; enum tree_code code; }
  101.  
  102. /* All identifiers that are not reserved words
  103.    and are not declared typedefs in the current block */
  104. %token IDENTIFIER
  105.  
  106. /* All identifiers that are declared typedefs in the current block.
  107.    In some contexts, they are treated just like IDENTIFIER,
  108.    but they can also serve as typespecs in declarations.  */
  109. %token TYPENAME
  110.  
  111. /* Reserved words that specify storage class.
  112.    yylval contains an IDENTIFIER_NODE which indicates which one.  */
  113. %token SCSPEC
  114.  
  115. /* Reserved words that specify type.
  116.    yylval contains an IDENTIFIER_NODE which indicates which one.  */
  117. %token TYPESPEC
  118.  
  119. /* Reserved words that qualify type: "const" or "volatile".
  120.    yylval contains an IDENTIFIER_NODE which indicates which one.  */
  121. %token TYPE_QUAL
  122.  
  123. /* Character or numeric constants.
  124.    yylval is the node for the constant.  */
  125. %token CONSTANT
  126.  
  127. /* String constants in raw form.
  128.    yylval is a STRING_CST node.  */
  129. %token STRING
  130.  
  131. /* "...", used for functions with variable arglists.  */
  132. %token ELLIPSIS
  133.  
  134. /* the reserved words */
  135. /* SCO include files test "ASM", so use something else. */
  136. %token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
  137. %token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
  138. %token SIGOF
  139. %token ATTRIBUTE EXTENSION LABEL
  140.  
  141. /* the reserved words... C++ extensions */
  142. %token <ttype> AGGR
  143. %token <itype> VISSPEC
  144. %token DELETE NEW OVERLOAD THIS OPERATOR CXX_TRUE CXX_FALSE
  145. %token NAMESPACE TYPENAME_KEYWORD USING
  146. %token LEFT_RIGHT TEMPLATE
  147. %token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST
  148. %token <itype> SCOPE
  149.  
  150. ifwin32
  151. /* Used to specify __declspec(xxx) in Windows.  */
  152. %token DECLSPEC DLL_EXPORT DLL_IMPORT /* THREAD NAKED */
  153. end ifwin32
  154.  
  155. /* Define the operator tokens and their precedences.
  156.    The value is an integer because, if used, it is the tree code
  157.    to use in the expression made from the operator.  */
  158.  
  159. %left EMPTY            /* used to resolve s/r with epsilon */
  160.  
  161. %left error
  162.  
  163. /* Add precedence rules to solve dangling else s/r conflict */
  164. %nonassoc IF
  165. %nonassoc ELSE
  166.  
  167. %left IDENTIFIER TYPENAME PTYPENAME SCSPEC TYPESPEC TYPE_QUAL ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD
  168.  
  169. %left '{' ',' ';'
  170.  
  171. %nonassoc THROW
  172. %right <code> ':'
  173. %right <code> ASSIGN '='
  174. %right <code> '?'
  175. %left <code> OROR
  176. %left <code> ANDAND
  177. %left <code> '|'
  178. %left <code> '^'
  179. %left <code> '&'
  180. %left <code> MIN_MAX
  181. %left <code> EQCOMPARE
  182. %left <code> ARITHCOMPARE '<' '>'
  183. %left <code> LSHIFT RSHIFT
  184. %left <code> '+' '-'
  185. %left <code> '*' '/' '%'
  186. %left <code> POINTSAT_STAR DOT_STAR
  187. %right <code> UNARY PLUSPLUS MINUSMINUS '~'
  188. %left HYPERUNARY
  189. %left <ttype> PAREN_STAR_PAREN LEFT_RIGHT
  190. %left <code> POINTSAT '.' '(' '['
  191.  
  192. %right SCOPE            /* C++ extension */
  193. %nonassoc NEW DELETE TRY CATCH
  194.  
  195. %type <code> unop
  196.  
  197. %type <ttype> identifier IDENTIFIER TYPENAME CONSTANT expr nonnull_exprlist
  198. %type <ttype> paren_expr_or_null nontrivial_exprlist
  199. %type <ttype> expr_no_commas cast_expr unary_expr primary string STRING
  200. %type <ttype> typed_declspecs reserved_declspecs boolean.literal
  201. %type <ttype> typed_typespecs reserved_typespecquals
  202. %type <ttype> declmods typespec typespecqual_reserved
  203. %type <ttype> SCSPEC TYPESPEC TYPE_QUAL nonempty_type_quals maybe_type_qual
  204. %type <itype> initdecls notype_initdecls initdcl    /* C++ modification */
  205. %type <ttype> init initlist maybeasm maybe_init
  206. %type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers
  207. %type <ttype> maybe_attribute attributes attribute attribute_list attrib
  208. %type <ttype> any_word
  209.  
  210. %type <ttype> compstmt implicitly_scoped_stmt
  211.  
  212. %type <ttype> declarator notype_declarator after_type_declarator
  213. %type <ttype> direct_notype_declarator direct_after_type_declarator
  214.  
  215. %type <ttype> structsp opt.component_decl_list component_decl_list
  216. %type <ttype> component_decl component_decl_1 components notype_components
  217. %type <ttype> component_declarator component_declarator0
  218. %type <ttype> notype_component_declarator notype_component_declarator0
  219. %type <ttype> after_type_component_declarator after_type_component_declarator0
  220. %type <ttype> enumlist enumerator
  221. %type <ttype> type_id absdcl type_quals
  222. %type <ttype> direct_abstract_declarator conversion_declarator
  223. %type <ttype> new_type_id new_declarator direct_new_declarator
  224. %type <ttype> xexpr parmlist parms parm bad_parm full_parm
  225. %type <ttype> identifiers_or_typenames
  226. %type <ttype> fcast_or_absdcl regcast_or_absdcl
  227. %type <ttype> expr_or_declarator complex_notype_declarator
  228. %type <ttype> notype_unqualified_id unqualified_id qualified_id
  229. %type <ttype> overqualified_id notype_qualified_id any_id
  230. %type <ttype> complex_direct_notype_declarator functional_cast
  231. %type <ttype> named_parm complex_parmlist typed_declspecs1 parms_comma
  232.  
  233. /* C++ extensions */
  234. %token <ttype> TYPENAME_ELLIPSIS PTYPENAME
  235. %token <ttype> PRE_PARSED_FUNCTION_DECL EXTERN_LANG_STRING ALL
  236. %token <ttype> PRE_PARSED_CLASS_DECL
  237. %type <ttype> fn.def1 /* Not really! */
  238. %type <ttype> fn.def2 return_id
  239. %type <itype> ctor_initializer_opt
  240. %type <ttype> named_class_head named_class_head_sans_basetype
  241. %type <ttype> named_complex_class_head_sans_basetype
  242. %type <ttype> unnamed_class_head
  243. %type <ttype> class_head base_class_list
  244. %type <itype> base_class_access_list
  245. %type <ttype> base_class maybe_base_class_list base_class.1
  246. %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
  247. %type <ttype> operator_name
  248. %type <ttype> object aggr
  249. %type <itype> new delete
  250. /* %type <ttype> primary_no_id */
  251. %type <ttype> nonmomentary_expr maybe_parmlist
  252. %type <itype> initdcl0 notype_initdcl0 member_init_list
  253. %type <ttype> template_header template_parm_list template_parm
  254. %type <ttype> template_type_parm
  255. %type <ttype> template_type template_arg_list template_arg
  256. %type <ttype> template_instantiation template_type_name tmpl.2
  257. %type <ttype> template_instantiate_once template_instantiate_some
  258. %type <itype> fn_tmpl_end
  259. /* %type <itype> try_for_typename */
  260. %type <ttype> condition xcond paren_cond_or_null
  261. %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
  262. %type <ttype> qualified_type_name complete_type_name notype_identifier
  263. %type <ttype> complex_type_name nested_name_specifier_1
  264. %type <itype> nomods_initdecls nomods_initdcl0
  265. %type <ttype> new_initializer new_placement specialization type_specifier_seq
  266. %type <ttype> using_decl .poplevel
  267.  
  268. /* in order to recognize aggr tags as defining and thus shadowing. */
  269. %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
  270. %type <ttype> named_class_head_sans_basetype_defn 
  271. %type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
  272.  
  273. %token NSNAME
  274. %type <ttype> NSNAME
  275.  
  276. /* Used in lex.c for parsing pragmas.  */
  277. %token END_OF_LINE
  278.  
  279. ifwin32
  280. /* Extra goodies for WINNT */
  281. %type <ttype> DECLSPEC DLL_EXPORT DLL_IMPORT /* THREAD NAKED */
  282. %type <ttype> declspec
  283. %type <ttype> declspec_attribute
  284. end ifwin32
  285.  
  286. /* lex.c and pt.c depends on this being the last token.  Define
  287.    any new tokens before this one!  */
  288. %token END_OF_SAVED_INPUT
  289.  
  290. %{
  291. /* List of types and structure classes of the current declaration.  */
  292. static tree current_declspecs;
  293. /* List of prefix attributes in effect.
  294.    Prefix attributes are parsed by the reserved_declspecs and declmods
  295.    rules.  They create a list that contains *both* declspecs and attrs.  */
  296. /* ??? It is not clear yet that all cases where an attribute can now appear in
  297.    a declspec list have been updated.  */
  298. static tree prefix_attributes;
  299.  
  300. /* When defining an aggregate, this is the most recent one being defined.  */
  301. static tree current_aggr;
  302.  
  303. /* Tell yyparse how to print a token's value, if yydebug is set.  */
  304.  
  305. #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
  306. extern void yyprint ();
  307. extern tree combine_strings        PROTO((tree));
  308. %}
  309.  
  310. %%
  311. program: /* empty */
  312.     | extdefs
  313.         {
  314.           /* In case there were missing closebraces,
  315.              get us back to the global binding level.  */
  316.           while (! global_bindings_p ())
  317.             poplevel (0, 0, 0);
  318.           finish_file ();
  319.         }
  320.     ;
  321.  
  322. /* the reason for the strange actions in this rule
  323.  is so that notype_initdecls when reached via datadef
  324.  can find a valid list of type and sc specs in $0. */
  325.  
  326. extdefs:
  327.       { $<ttype>$ = NULL_TREE; } lang_extdef
  328.         { $<ttype>$ = NULL_TREE; }
  329.     | extdefs lang_extdef
  330.         { $<ttype>$ = NULL_TREE; }
  331.     ;
  332.  
  333. extdefs_opt:
  334.       extdefs
  335.     | /* empty */
  336.     ;
  337.  
  338. .hush_warning:
  339.         { have_extern_spec = 1;
  340.           used_extern_spec = 0;
  341.           $<ttype>$ = NULL_TREE; }
  342.     ;
  343. .warning_ok:
  344.         { have_extern_spec = 0; }
  345.     ;
  346.  
  347. asm_keyword:
  348.       ASM_KEYWORD
  349.     | GCC_ASM_KEYWORD
  350.     ;
  351.  
  352. lang_extdef:
  353.       { if (pending_lang_change) do_pending_lang_change(); }
  354.       extdef
  355.       { if (! toplevel_bindings_p () && ! pseudo_global_level_p())
  356.           pop_everything (); }
  357.     ;
  358.  
  359. ifwin32
  360. declspec:    DECLSPEC  '(' declspec_attribute ')' {$$ = $3;}
  361.     ;
  362.  
  363. declspec_attribute:
  364.     DLL_EXPORT
  365.     |    DLL_IMPORT
  366. /*    |    THREAD
  367.     |    NAKED    */
  368.     ;    
  369. end ifwin32
  370.  
  371. extdef:
  372.       fndef
  373.         { if (pending_inlines) do_pending_inlines (); }
  374.     | datadef
  375.         { if (pending_inlines) do_pending_inlines (); }
  376.     | template_def
  377.         { if (pending_inlines) do_pending_inlines (); }
  378.     | overloaddef
  379.     | asm_keyword '(' string ')' ';'
  380.         { if (TREE_CHAIN ($3)) $3 = combine_strings ($3);
  381.           assemble_asm ($3); }
  382.     | extern_lang_string '{' extdefs_opt '}'
  383.         { pop_lang_context (); }
  384.     | extern_lang_string .hush_warning fndef .warning_ok
  385.         { if (pending_inlines) do_pending_inlines ();
  386.           pop_lang_context (); }
  387.     | extern_lang_string .hush_warning datadef .warning_ok
  388.         { if (pending_inlines) do_pending_inlines ();
  389.           pop_lang_context (); }
  390.     | NAMESPACE identifier '{'
  391.         { push_namespace ($2); }
  392.       extdefs_opt '}'
  393.         { pop_namespace (); }
  394.     | NAMESPACE '{'
  395.         { push_namespace (NULL_TREE); }
  396.       extdefs_opt '}'
  397.         { pop_namespace (); }
  398.     | NAMESPACE identifier '=' any_id ';'
  399.         { do_namespace_alias ($2, $4); }
  400.     | using_decl ';'
  401.         { do_toplevel_using_decl ($1); }
  402.     | USING NAMESPACE any_id ';'
  403.         { do_using_directive ($3); }
  404.     ;
  405.  
  406. using_decl:
  407.       USING qualified_id
  408.         { $$ = $2; }
  409.     | USING global_scope qualified_id
  410.         { $$ = $3; }
  411.     | USING global_scope unqualified_id
  412.         { $$ = $3; }
  413.     ;
  414.  
  415. any_id:
  416.       unqualified_id
  417.     | qualified_id
  418.     | global_scope qualified_id
  419.         { $$ = $2; }
  420.     | global_scope unqualified_id
  421.         { $$ = $2; }
  422.     ;
  423.  
  424. extern_lang_string:
  425.     EXTERN_LANG_STRING
  426.         { push_lang_context ($1); }
  427.     | extern_lang_string EXTERN_LANG_STRING
  428.         { if (current_lang_name != $2)
  429.             cp_error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name);
  430.           pop_lang_context (); push_lang_context ($2); }
  431.     ;
  432.  
  433. template_header:
  434.       TEMPLATE '<'
  435.         { begin_template_parm_list (); }
  436.       template_parm_list '>'
  437.         { $$ = end_template_parm_list ($4); }
  438.     ;
  439.  
  440. template_parm_list:
  441.       template_parm
  442.         { $$ = process_template_parm (NULL_TREE, $1); }
  443.     | template_parm_list ',' template_parm
  444.         { $$ = process_template_parm ($1, $3); }
  445.     ;
  446.  
  447. template_type_parm:
  448.       aggr
  449.         { 
  450.           $$ = build_tree_list ($1, NULL_TREE);
  451.          ttpa:
  452.           if (TREE_PURPOSE ($$) == signature_type_node)
  453.             sorry ("signature as template type parameter");
  454.           else if (TREE_PURPOSE ($$) != class_type_node)
  455.             pedwarn ("template type parameters must use the keyword `class'");
  456.         }
  457.     | aggr identifier
  458.         { $$ = build_tree_list ($1, $2); goto ttpa; }
  459.     | TYPENAME_KEYWORD
  460.         { $$ = build_tree_list (class_type_node, NULL_TREE); }
  461.     | TYPENAME_KEYWORD identifier
  462.         { $$ = build_tree_list (class_type_node, $2); }
  463.     ;
  464.  
  465. template_parm:
  466.     /* The following rules introduce a new reduce/reduce
  467.        conflict on the ',' and '>' input tokens: they are valid
  468.        prefixes for a `structsp', which means they could match a
  469.        nameless parameter.  See 14.6, paragraph 3.
  470.        By putting them before the `parm' rule, we get
  471.        their match before considering them nameless parameter
  472.        declarations.  */
  473.       template_type_parm
  474.         { $$ = build_tree_list (NULL_TREE, $$); }
  475.     | template_type_parm '=' typespec
  476.         { $$ = build_tree_list ($3, $$); }
  477.     | full_parm
  478.     ;
  479.  
  480. overloaddef:
  481.       OVERLOAD ov_identifiers ';'
  482.         { warning ("use of `overload' is an anachronism"); }
  483.     ;
  484.  
  485. ov_identifiers: IDENTIFIER
  486.         { declare_overloaded ($1); }
  487.     | ov_identifiers ',' IDENTIFIER
  488.         { declare_overloaded ($3); }
  489.     ;
  490.       
  491. template_def:
  492.     /* Class template declarations go here; they aren't normal class
  493.        declarations, because we can't process the bodies yet.  */
  494.       template_header named_class_head_sans_basetype '{'
  495.         { yychar = '{'; goto template1; }
  496.      ';'
  497.     | template_header named_class_head_sans_basetype_defn '{'
  498.         { yychar = '{'; goto template1; }
  499.      ';'
  500.     | template_header named_class_head_sans_basetype ':'
  501.         { yychar = ':'; goto template1; }
  502.      ';'
  503.     | template_header named_class_head_sans_basetype_defn ':'
  504.         {
  505.           yychar = ':';
  506.         template1:
  507.           if (current_aggr == signature_type_node)
  508.             sorry ("template type defining a signature");
  509.           /* Maybe pedantic warning for union?
  510.              How about an enum? :-)  */
  511.           end_template_decl ($1, $2, current_aggr, 1);
  512.           reinit_parse_for_template (yychar, $1, $2);
  513.           yychar = YYEMPTY;
  514.         }
  515.       ';'
  516.     | template_header named_class_head_sans_basetype ';'
  517.         {
  518.           end_template_decl ($1, $2, current_aggr, 0);
  519.           /* declare $2 as template name with $1 parm list */
  520.         }
  521.     | template_header named_class_head_sans_basetype_defn ';'
  522.         {
  523.           end_template_decl ($1, $2, current_aggr, 0);
  524.           /* declare $2 as template name with $1 parm list */
  525.         }
  526.     | template_header /* notype_initdcl0 ';' */
  527.       notype_declarator exception_specification_opt maybeasm maybe_attribute
  528.       fn_tmpl_end
  529.         {
  530.           tree d;
  531.           int momentary;
  532.           int def = ($6 != ';');
  533.           momentary = suspend_momentary ();
  534.           d = start_decl ($<ttype>2, /*current_declspecs*/NULL_TREE, 0,
  535.                   $3);
  536.           cplus_decl_attributes (d, $5, /*prefix_attributes*/NULL_TREE);
  537.           cp_finish_decl (d, NULL_TREE, $4, 0, 0);
  538.           end_template_decl ($1, d, 0, def);
  539.           if (def)
  540.             reinit_parse_for_template ((int) $6, $1, d);
  541.           resume_momentary (momentary);
  542.         }
  543.     | template_header typed_declspecs /*initdcl0*/
  544.       declarator exception_specification_opt maybeasm maybe_attribute
  545.       fn_tmpl_end
  546.         {
  547.           tree d, specs, attrs;
  548.           int momentary;
  549.           int def = ($7 != ';');
  550.           split_specs_attrs ($2, &specs, &attrs);
  551.           momentary = suspend_momentary ();
  552.           d = start_decl ($<ttype>3, specs, 0, $<ttype>4);
  553.           cplus_decl_attributes (d, $6, attrs);
  554.           cp_finish_decl (d, NULL_TREE, $5, 0, 0);
  555.           end_template_decl ($1, d, 0, def);
  556.           if (def)
  557.             {
  558.               reinit_parse_for_template ((int) $7, $1, d);
  559.               yychar = YYEMPTY;
  560.             }
  561.           note_list_got_semicolon ($<ttype>2);
  562.           resume_momentary (momentary);
  563.         }
  564.     | template_header declmods notype_declarator fn_tmpl_end
  565.         {
  566.           tree d, specs, attrs;
  567.           int def = ($4 != ';');
  568.           split_specs_attrs ($2, &specs, &attrs);
  569.           d = start_decl ($<ttype>3, specs, 0, NULL_TREE);
  570.           cplus_decl_attributes (d, NULL_TREE, attrs);
  571.           cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
  572.           end_template_decl ($1, d, 0, def);
  573.           if (def)
  574.             reinit_parse_for_template ((int) $4, $1, d);
  575.         }
  576.     /* Try to recover from syntax errors in templates.  */
  577.     | template_header error '}'    { end_template_decl ($1, 0, 0, 0); }
  578.     | template_header error ';'    { end_template_decl ($1, 0, 0, 0); }
  579.     ;
  580.  
  581. fn_tmpl_end: '{'        { $$ = '{'; }
  582.     | ':'            { $$ = ':'; }
  583.     | ';'            { $$ = ';'; }
  584.     | '='            { $$ = '='; }
  585.     | RETURN        { $$ = RETURN; }
  586.     ;
  587.  
  588. datadef:
  589.       nomods_initdecls ';'
  590.         {}
  591.     | declmods notype_initdecls ';'
  592.         {}
  593.     /* Normal case to make fast: "const i;".  */
  594.     | declmods notype_declarator ';'
  595.         { tree d, specs, attrs;
  596.           split_specs_attrs ($1, &specs, &attrs);
  597.           d = start_decl ($<ttype>2, specs, 0, NULL_TREE);
  598.           cplus_decl_attributes (d, NULL_TREE, attrs);
  599.           cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
  600.         }
  601.     | typed_declspecs initdecls ';'
  602.         {
  603.           note_list_got_semicolon ($<ttype>$);
  604.         }
  605.     /* Normal case: make this fast.  */
  606.     | typed_declspecs declarator ';'
  607.         { tree d, specs, attrs;
  608.           split_specs_attrs ($1, &specs, &attrs);
  609.           d = start_decl ($<ttype>2, specs, 0, NULL_TREE);
  610.           cplus_decl_attributes (d, NULL_TREE, attrs);
  611.           cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
  612.           note_list_got_semicolon ($<ttype>$);
  613.         }
  614.         | declmods ';'
  615.       { pedwarn ("empty declaration"); }
  616.     | explicit_instantiation ';'
  617.     | typed_declspecs ';'
  618.       {
  619.         tree t, attrs;
  620.         split_specs_attrs ($1, &t, &attrs);
  621.         shadow_tag (t);
  622.         if (TREE_CODE (t) == TREE_LIST
  623.         && TREE_PURPOSE (t) == NULL_TREE)
  624.           {
  625.         t = TREE_VALUE (t);
  626.         if (IS_AGGR_TYPE (t)
  627.             && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (t)))
  628.           {
  629.             if (CLASSTYPE_USE_TEMPLATE (t) == 0)
  630.               SET_CLASSTYPE_TEMPLATE_SPECIALIZATION (t);
  631.             else if (CLASSTYPE_TEMPLATE_INSTANTIATION (t))
  632.               error ("override declaration for already-expanded template");
  633.           }
  634.           }
  635.         note_list_got_semicolon ($<ttype>$);
  636.       }
  637.     | error ';'
  638.     | error '}'
  639.     | ';'
  640.     ;
  641.  
  642. ctor_initializer_opt:
  643.       nodecls
  644.         { $$ = 0; }
  645.     | base_init
  646.         { $$ = 1; }
  647.     ;
  648.  
  649. maybe_return_init:
  650.       /* empty */
  651.     | return_init
  652.     | return_init ';'
  653.     ;
  654.  
  655. eat_saved_input:
  656.       /* empty */
  657.     | END_OF_SAVED_INPUT
  658.     ;
  659.  
  660. fndef:
  661.       fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
  662.         {
  663.           finish_function (lineno, (int)$3, 0);
  664.           if ($<ttype>$) process_next_inline ($<ttype>$);
  665.         }
  666.     | fn.def1 maybe_return_init function_try_block
  667.         {
  668.           if ($<ttype>$) process_next_inline ($<ttype>$);
  669.         }
  670.       eat_saved_input
  671.     | typed_declspecs declarator error
  672.         {}
  673.     | declmods notype_declarator error
  674.         {}
  675.     | notype_declarator error
  676.         {}
  677.     ;
  678.  
  679. fn.def1:
  680.       typed_declspecs declarator exception_specification_opt
  681.         { tree specs, attrs;
  682.           split_specs_attrs ($1, &specs, &attrs);
  683.           if (! start_function (specs, $2, $3, attrs, 0))
  684.             YYERROR1;
  685.           reinit_parse_for_function ();
  686.           $$ = NULL_TREE; }
  687.     | declmods notype_declarator exception_specification_opt
  688.         { tree specs = strip_attrs ($1);
  689.           if (! start_function (specs, $2, $3, NULL_TREE, 0))
  690.             YYERROR1;
  691.           reinit_parse_for_function ();
  692.           $$ = NULL_TREE; }
  693.     | notype_declarator exception_specification_opt
  694.         { if (! start_function (NULL_TREE, $$, $2, NULL_TREE, 0))
  695.             YYERROR1;
  696.           reinit_parse_for_function ();
  697.           $$ = NULL_TREE; }
  698.     | PRE_PARSED_FUNCTION_DECL
  699.         { start_function (NULL_TREE, TREE_VALUE ($$),
  700.                   NULL_TREE, NULL_TREE, 1);
  701.           reinit_parse_for_function (); }
  702.     ;
  703.  
  704. /* more C++ complexity.  See component_decl for a comment on the
  705.    reduce/reduce conflict introduced by these rules.  */
  706. fn.def2:
  707.       typed_declspecs '(' parmlist ')' type_quals exception_specification_opt
  708.         { tree specs = strip_attrs ($1);
  709.           $$ = build_parse_node (CALL_EXPR, TREE_VALUE (specs), $3, $5);
  710.           $$ = start_method (TREE_CHAIN (specs), $$, $6);
  711.          rest_of_mdef:
  712.           if (! $$)
  713.             YYERROR1;
  714.           if (yychar == YYEMPTY)
  715.             yychar = YYLEX;
  716.           reinit_parse_for_method (yychar, $$); }
  717.     | typed_declspecs LEFT_RIGHT type_quals exception_specification_opt
  718.         { tree specs = strip_attrs ($1);
  719.           $$ = build_parse_node (CALL_EXPR, TREE_VALUE (specs),
  720.                      empty_parms (), $3);
  721.           $$ = start_method (TREE_CHAIN (specs), $$, $4);
  722.           goto rest_of_mdef;
  723.         }
  724.     | typed_declspecs declarator exception_specification_opt
  725.         { tree specs = strip_attrs ($1);
  726.           $$ = start_method (specs, $2, $3); goto rest_of_mdef; }
  727.     | declmods notype_declarator exception_specification_opt
  728.         { tree specs = strip_attrs ($1);
  729.           $$ = start_method (specs, $2, $3); goto rest_of_mdef; }
  730.     | notype_declarator exception_specification_opt
  731.         { $$ = start_method (NULL_TREE, $$, $2); goto rest_of_mdef; }
  732.     ;
  733.  
  734. return_id: RETURN IDENTIFIER
  735.         {
  736.           if (! current_function_parms_stored)
  737.             store_parm_decls ();
  738.           $$ = $2;
  739.         }
  740.     ;
  741.  
  742. return_init: return_id maybe_init
  743.         { store_return_init ($<ttype>$, $2); }
  744.     | return_id '(' nonnull_exprlist ')'
  745.         { store_return_init ($<ttype>$, $3); }
  746.     | return_id LEFT_RIGHT
  747.         { store_return_init ($<ttype>$, NULL_TREE); }
  748.     ;
  749.  
  750. base_init:
  751.       ':' .set_base_init member_init_list
  752.         {
  753.           if ($3 == 0)
  754.             error ("no base initializers given following ':'");
  755.           setup_vtbl_ptr ();
  756.           /* Always keep the BLOCK node associated with the outermost
  757.              pair of curley braces of a function.  These are needed
  758.              for correct operation of dwarfout.c.  */
  759.           keep_next_level ();
  760.         }
  761.     ;
  762.  
  763. .set_base_init:
  764.     /* empty */
  765.         {
  766.           if (! current_function_parms_stored)
  767.             store_parm_decls ();
  768.  
  769.           if (DECL_CONSTRUCTOR_P (current_function_decl))
  770.             {
  771.               /* Make a contour for the initializer list.  */
  772.               pushlevel (0);
  773.               clear_last_expr ();
  774.               expand_start_bindings (0);
  775.             }
  776.           else if (current_class_type == NULL_TREE)
  777.             error ("base initializers not allowed for non-member functions");
  778.           else if (! DECL_CONSTRUCTOR_P (current_function_decl))
  779.             error ("only constructors take base initializers");
  780.         }
  781.     ;
  782.  
  783. member_init_list:
  784.       /* empty */
  785.         { $$ = 0; }
  786.     | member_init
  787.         { $$ = 1; }
  788.     | member_init_list ',' member_init
  789.     | member_init_list error
  790.     ;
  791.  
  792. member_init: '(' nonnull_exprlist ')'
  793.         {
  794.           if (current_class_name && !flag_traditional)
  795.             pedwarn ("anachronistic old style base class initializer");
  796.           expand_member_init (C_C_D, NULL_TREE, $2);
  797.         }
  798.     | LEFT_RIGHT
  799.         {
  800.           if (current_class_name && !flag_traditional)
  801.             pedwarn ("anachronistic old style base class initializer");
  802.           expand_member_init (C_C_D, NULL_TREE, void_type_node);
  803.         }
  804.     | notype_identifier '(' nonnull_exprlist ')'
  805.         { expand_member_init (C_C_D, $<ttype>$, $3); }
  806.     | notype_identifier LEFT_RIGHT
  807.         { expand_member_init (C_C_D, $<ttype>$, void_type_node); }
  808.     | complete_type_name '(' nonnull_exprlist ')'
  809.         { expand_member_init (C_C_D, $<ttype>$, $3); }
  810.     | complete_type_name LEFT_RIGHT
  811.         { expand_member_init (C_C_D, $<ttype>$, void_type_node); }
  812.     /* GNU extension */
  813.     | notype_qualified_id '(' nonnull_exprlist ')'
  814.         {
  815.           do_member_init (OP0 ($1), OP1 ($1), $3);
  816.         }
  817.     | notype_qualified_id LEFT_RIGHT
  818.         {
  819.           do_member_init (OP0 ($1), OP1 ($1), void_type_node);
  820.         }
  821.     ;
  822.  
  823. identifier:
  824.       IDENTIFIER
  825.     | TYPENAME
  826.     | PTYPENAME
  827.     | NSNAME
  828.     ;
  829.  
  830. notype_identifier:
  831.       IDENTIFIER
  832.     | PTYPENAME 
  833.     | NSNAME %prec EMPTY
  834.     ;
  835.  
  836. identifier_defn:
  837.       IDENTIFIER_DEFN
  838.     | TYPENAME_DEFN
  839.     | PTYPENAME_DEFN
  840.     ;
  841.  
  842. explicit_instantiation:
  843.       TEMPLATE specialization template_instantiation
  844.         { do_type_instantiation ($3 ? $3 : $2, NULL_TREE); }
  845.     | TEMPLATE typed_declspecs declarator
  846.         { tree specs = strip_attrs ($2);
  847.           do_function_instantiation (specs, $3, NULL_TREE); }
  848.     | TEMPLATE notype_declarator
  849.         { do_function_instantiation (NULL_TREE, $2, NULL_TREE); }
  850.     | SCSPEC TEMPLATE specialization template_instantiation
  851.         { do_type_instantiation ($4 ? $4 : $3, $1); }
  852.     | SCSPEC TEMPLATE typed_declspecs declarator
  853.         { tree specs = strip_attrs ($3);
  854.           do_function_instantiation (specs, $4, $1); }
  855.     | SCSPEC TEMPLATE notype_declarator
  856.         { do_function_instantiation (NULL_TREE, $3, $1); }
  857.     ;
  858.  
  859. template_type:
  860.       template_type_name tmpl.2 template_instantiation
  861.         { if ($3) $$ = $3; }
  862.     ;
  863.  
  864. template_type_name:
  865.       PTYPENAME '<' template_arg_list '>'
  866.         { $$ = lookup_template_class ($$, $3, NULL_TREE); }
  867.     | PTYPENAME '<' '>'
  868.         { $$ = lookup_template_class ($$, NULL_TREE, NULL_TREE); }
  869.     | TYPENAME  '<' template_arg_list '>'
  870.         { $$ = lookup_template_class ($$, $3, NULL_TREE); }
  871.     ;
  872.  
  873. tmpl.2: 
  874.       /* empty */ %prec EMPTY
  875.         { $$ = instantiate_class_template ($<ttype>0, 1); }
  876.     ;
  877.  
  878. template_arg_list:
  879.       template_arg
  880.         { $$ = build_tree_list (NULL_TREE, $$); }
  881.     | template_arg_list ',' template_arg
  882.         { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); }
  883.     ;
  884.  
  885. template_arg:
  886.       type_id
  887.         { $$ = groktypename ($$); }
  888.     | expr_no_commas  %prec UNARY
  889.     ;
  890.  
  891. template_instantiate_once:
  892.       PRE_PARSED_CLASS_DECL maybe_base_class_list
  893.         {
  894.           tree t, decl, tmpl;
  895.  
  896.           tmpl = TREE_PURPOSE (IDENTIFIER_TEMPLATE ($1));
  897.           t = xref_tag (DECL_TEMPLATE_INFO (tmpl)->aggr, $1, $2, 0);
  898.           set_current_level_tags_transparency (1);
  899.           my_friendly_assert (TREE_CODE (t) == RECORD_TYPE
  900.                       || TREE_CODE (t) == UNION_TYPE, 257);
  901.           $<ttype>$ = t;
  902.  
  903.           /* Now, put a copy of the decl in global scope, to avoid
  904.              recursive expansion.  */
  905.           decl = IDENTIFIER_LOCAL_VALUE ($1);
  906.           if (!decl)
  907.             decl = IDENTIFIER_CLASS_VALUE ($1);
  908.           /* Now, put a copy of the decl in global scope, to avoid
  909.              recursive expansion.  */
  910.                   if (decl)
  911.                     {
  912.               /* Need to copy it to clear the chain pointer,
  913.              and need to get it into permanent storage.  */
  914.                       my_friendly_assert (TREE_CODE (decl) == TYPE_DECL, 258);
  915.               push_obstacks (&permanent_obstack, &permanent_obstack);
  916.                       decl = copy_node (decl);
  917.               if (DECL_LANG_SPECIFIC (decl))
  918.             copy_lang_decl (decl);
  919.               pop_obstacks ();
  920.               pushdecl_top_level (decl);
  921.             }
  922.           /* Kludge; see instantiate_class_template.  */
  923.           TYPE_BEING_DEFINED (t) = 0;
  924.         }
  925.       left_curly opt.component_decl_list '}'
  926.         {
  927.           tree t = finish_struct ($<ttype>3, $5, 0);
  928.  
  929.           pop_obstacks ();
  930.           end_template_instantiation ($1);
  931.  
  932.           repo_template_used (t);
  933.  
  934.                   /* Now go after the methods & class data.  */
  935.                   instantiate_member_templates ($1);
  936.  
  937.           pop_tinst_level();
  938.  
  939.           CLASSTYPE_GOT_SEMICOLON (t) = 1;
  940.         }
  941.     ;
  942.  
  943. template_instantiation:
  944.           /* empty */
  945.                 { $$ = NULL_TREE; }
  946.         | template_instantiate_once
  947.                 { $$ = $1; }
  948.         ;
  949.  
  950. template_instantiate_some:
  951.           /* empty */
  952.                 { $$ = NULL_TREE; /* never used from here... */}
  953.         | template_instantiate_once template_instantiate_some
  954.                 { $$ = $1; /*???*/ }
  955.         ;
  956.  
  957. unop:     '-'
  958.         { $$ = NEGATE_EXPR; }
  959.     | '+'
  960.         { $$ = CONVERT_EXPR; }
  961.     | PLUSPLUS
  962.         { $$ = PREINCREMENT_EXPR; }
  963.     | MINUSMINUS
  964.         { $$ = PREDECREMENT_EXPR; }
  965.     | '!'
  966.         { $$ = TRUTH_NOT_EXPR; }
  967.     ;
  968.  
  969. expr:      nontrivial_exprlist
  970.         { $$ = build_x_compound_expr ($$); }
  971.     | expr_no_commas
  972.     ;
  973.  
  974. paren_expr_or_null:
  975.     LEFT_RIGHT
  976.         { error ("ANSI C++ forbids an empty condition for `%s'",
  977.              cond_stmt_keyword);
  978.           $$ = integer_zero_node; }
  979.     | '(' expr ')'
  980.         { $$ = condition_conversion ($2); }
  981.     ;
  982.  
  983. paren_cond_or_null:
  984.     LEFT_RIGHT
  985.         { error ("ANSI C++ forbids an empty condition for `%s'",
  986.              cond_stmt_keyword);
  987.           $$ = integer_zero_node; }
  988.     | '(' condition ')'
  989.         { $$ = condition_conversion ($2); }
  990.     ;
  991.  
  992. xcond:
  993.     /* empty */
  994.         { $$ = NULL_TREE; }
  995.     | condition
  996.         { $$ = condition_conversion ($$); }
  997.     | error
  998.         { $$ = NULL_TREE; }
  999.     ;
  1000.  
  1001. condition:
  1002.     type_specifier_seq declarator exception_specification_opt maybeasm maybe_attribute '='
  1003.         { {
  1004.           tree d;
  1005.           for (d = getdecls (); d; d = TREE_CHAIN (d))
  1006.             if (TREE_CODE (d) == TYPE_DECL) {
  1007.               tree s = TREE_TYPE (d);
  1008.               if (TREE_CODE (s) == RECORD_TYPE)
  1009.             cp_error ("definition of class `%T' in condition", s);
  1010.               else if (TREE_CODE (s) == ENUMERAL_TYPE)
  1011.             cp_error ("definition of enum `%T' in condition", s);
  1012.             }
  1013.           }
  1014.           current_declspecs = $1;
  1015.           $<itype>6 = suspend_momentary ();
  1016.           $<ttype>$ = start_decl ($<ttype>2, current_declspecs, 1, $3);
  1017.           cplus_decl_attributes ($<ttype>$, $5,
  1018.                      /*prefix_attributes*/ NULL_TREE);
  1019.         }
  1020.     init
  1021.         { 
  1022.           cp_finish_decl ($<ttype>7, $8, $5, 0, LOOKUP_ONLYCONVERTING);
  1023.           resume_momentary ($<itype>6);
  1024.           $$ = $<ttype>7; 
  1025.           if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE)
  1026.             cp_error ("definition of array `%#D' in condition", $$); 
  1027.         }
  1028.     | expr
  1029.     ;
  1030.  
  1031. compstmtend:
  1032.       '}'
  1033.     | maybe_label_decls stmts '}'
  1034.     | maybe_label_decls stmts error '}'
  1035.     | maybe_label_decls error '}'
  1036.     ;
  1037.  
  1038. already_scoped_stmt:
  1039.       '{' compstmtend
  1040.         { finish_stmt (); }
  1041.     | simple_stmt
  1042.     ;
  1043.  
  1044.  
  1045. nontrivial_exprlist:
  1046.       expr_no_commas ',' expr_no_commas
  1047.         { $$ = tree_cons (NULL_TREE, $$, 
  1048.                           build_tree_list (NULL_TREE, $3)); }
  1049.     | expr_no_commas ',' error
  1050.         { $$ = tree_cons (NULL_TREE, $$, 
  1051.                           build_tree_list (NULL_TREE, error_mark_node)); }
  1052.     | nontrivial_exprlist ',' expr_no_commas
  1053.         { chainon ($$, build_tree_list (NULL_TREE, $3)); }
  1054.     | nontrivial_exprlist ',' error
  1055.         { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); }
  1056.     ;
  1057.  
  1058. nonnull_exprlist:
  1059.       expr_no_commas
  1060.         { $$ = build_tree_list (NULL_TREE, $$); }
  1061.     | nontrivial_exprlist
  1062.     ;
  1063.  
  1064. unary_expr:
  1065.       primary %prec UNARY
  1066.         {
  1067. #if 0
  1068.           if (TREE_CODE ($$) == TYPE_EXPR)
  1069.             $$ = build_component_type_expr (C_C_D, $$, NULL_TREE, 1);
  1070. #endif
  1071.         }
  1072.     /* __extension__ turns off -pedantic for following primary.  */
  1073.     | EXTENSION
  1074.         { $<itype>1 = pedantic;
  1075.           pedantic = 0; }
  1076.       cast_expr      %prec UNARY
  1077.         { $$ = $3;
  1078.           pedantic = $<itype>1; }
  1079.     | '*' cast_expr   %prec UNARY
  1080.         { $$ = build_x_indirect_ref ($2, "unary *"); }
  1081.     | '&' cast_expr   %prec UNARY
  1082.         { $$ = build_x_unary_op (ADDR_EXPR, $2); }
  1083.     | '~' cast_expr
  1084.         { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); }
  1085.     | unop cast_expr  %prec UNARY
  1086.         { $$ = build_x_unary_op ($1, $2);
  1087.           if ($1 == NEGATE_EXPR && TREE_CODE ($2) == INTEGER_CST)
  1088.             TREE_NEGATED_INT ($$) = 1;
  1089.           overflow_warning ($$);
  1090.         }
  1091.     /* Refer to the address of a label as a pointer.  */
  1092.     | ANDAND identifier
  1093.         { tree label = lookup_label ($2);
  1094.           if (label == NULL_TREE)
  1095.             $$ = null_pointer_node;
  1096.           else
  1097.             {
  1098.               TREE_USED (label) = 1;
  1099.               $$ = build1 (ADDR_EXPR, ptr_type_node, label);
  1100.               TREE_CONSTANT ($$) = 1;
  1101.             }
  1102.         }
  1103.     | SIZEOF unary_expr  %prec UNARY
  1104.         { if (TREE_CODE ($2) == COMPONENT_REF
  1105.               && DECL_BIT_FIELD (TREE_OPERAND ($2, 1)))
  1106.             error ("sizeof applied to a bit-field");
  1107.           /* ANSI says arrays and functions are converted inside comma.
  1108.              But we can't really convert them in build_compound_expr
  1109.              because that would break commas in lvalues.
  1110.              So do the conversion here if operand was a comma.  */
  1111.           if (TREE_CODE ($2) == COMPOUND_EXPR
  1112.               && (TREE_CODE (TREE_TYPE ($2)) == ARRAY_TYPE
  1113.               || TREE_CODE (TREE_TYPE ($2)) == FUNCTION_TYPE))
  1114.             $2 = default_conversion ($2);
  1115.           else if (TREE_CODE ($2) == TREE_LIST)
  1116.                 {
  1117.               tree t = TREE_VALUE ($2);
  1118.               if (t != NULL_TREE
  1119.               && ((TREE_TYPE (t)
  1120.                   && TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
  1121.                   || is_overloaded_fn (t)))
  1122.             pedwarn ("ANSI C++ forbids taking the sizeof a function type");
  1123.             }
  1124.           $$ = c_sizeof (TREE_TYPE ($2)); }
  1125.     | SIZEOF '(' type_id ')'  %prec HYPERUNARY
  1126.         { $$ = c_sizeof (groktypename ($3)); }
  1127.     | ALIGNOF unary_expr  %prec UNARY
  1128.         { $$ = grok_alignof ($2); }
  1129.     | ALIGNOF '(' type_id ')'  %prec HYPERUNARY
  1130.         { $$ = c_alignof (groktypename ($3)); }
  1131.  
  1132.     /* The %prec EMPTY's here are required by the = init initializer
  1133.        syntax extension; see below.  */
  1134.     | new new_type_id %prec EMPTY
  1135.         { $$ = build_new (NULL_TREE, $2, NULL_TREE, $1); }
  1136.     | new new_type_id new_initializer
  1137.         { $$ = build_new (NULL_TREE, $2, $3, $1); }
  1138.     | new new_placement new_type_id %prec EMPTY
  1139.         { $$ = build_new ($2, $3, NULL_TREE, $1); }
  1140.     | new new_placement new_type_id new_initializer
  1141.         { $$ = build_new ($2, $3, $4, $1); }
  1142.     | new '(' type_id ')' %prec EMPTY
  1143.         { $$ = build_new (NULL_TREE, groktypename($3),
  1144.                   NULL_TREE, $1); }
  1145.     | new '(' type_id ')' new_initializer
  1146.         { $$ = build_new (NULL_TREE, groktypename($3), $5, $1); }
  1147.     | new new_placement '(' type_id ')' %prec EMPTY
  1148.         { $$ = build_new ($2, groktypename($4), NULL_TREE, $1); }
  1149.     | new new_placement '(' type_id ')' new_initializer
  1150.         { $$ = build_new ($2, groktypename($4), $6, $1); }
  1151.  
  1152.     | delete cast_expr  %prec UNARY
  1153.         { $$ = delete_sanity ($2, NULL_TREE, 0, $1); }
  1154.     | delete '[' ']' cast_expr  %prec UNARY
  1155.         { $$ = delete_sanity ($4, NULL_TREE, 1, $1);
  1156.           if (yychar == YYEMPTY)
  1157.             yychar = YYLEX; }
  1158.     | delete '[' expr ']' cast_expr %prec UNARY
  1159.         { $$ = delete_sanity ($5, $3, 2, $1);
  1160.           if (yychar == YYEMPTY)
  1161.             yychar = YYLEX; }
  1162.     ;
  1163.  
  1164. new_placement:
  1165.       '(' nonnull_exprlist ')'
  1166.         { $$ = $2; }
  1167.     | '{' nonnull_exprlist '}'
  1168.         {
  1169.           $$ = $2; 
  1170.           pedwarn ("old style placement syntax, use () instead");
  1171.         }
  1172.     ;
  1173.  
  1174. new_initializer:
  1175.       '(' nonnull_exprlist ')'
  1176.         { $$ = $2; }
  1177.     | LEFT_RIGHT
  1178.         { $$ = NULL_TREE; }
  1179.     | '(' typespec ')'
  1180.         {
  1181.           cp_error ("`%T' is not a valid expression", $2);
  1182.           $$ = error_mark_node;
  1183.         }
  1184.     /* GNU extension so people can use initializer lists.  Note that
  1185.        this alters the meaning of `new int = 1', which was previously
  1186.        syntactically valid but semantically invalid.  */
  1187.     | '=' init
  1188.         {
  1189.           if (pedantic)
  1190.             pedwarn ("ANSI C++ forbids initialization of new expression with `='");
  1191.           $$ = $2;
  1192.         }
  1193.     ;
  1194.  
  1195. /* This is necessary to postpone reduction of `int ((int)(int)(int))'.  */
  1196. regcast_or_absdcl:
  1197.       '(' type_id ')' %prec EMPTY
  1198.         { $2 = tree_cons (NULL_TREE, $2, void_list_node);
  1199.           TREE_PARMLIST ($2) = 1;
  1200.           $$ = build_parse_node (CALL_EXPR, NULL_TREE, $2, 
  1201.                      NULL_TREE); }
  1202.     | regcast_or_absdcl '(' type_id ')' %prec EMPTY
  1203.         { $3 = tree_cons (NULL_TREE, $3, void_list_node);
  1204.           TREE_PARMLIST ($3) = 1;
  1205.           $$ = build_parse_node (CALL_EXPR, $$, $3, NULL_TREE); }
  1206.     ;
  1207.  
  1208. cast_expr:
  1209.       unary_expr
  1210.     | regcast_or_absdcl unary_expr  %prec UNARY
  1211.         { $$ = reparse_absdcl_as_casts ($$, $2); }
  1212.     | regcast_or_absdcl '{' initlist maybecomma '}'  %prec UNARY
  1213.         { 
  1214.           tree init = build_nt (CONSTRUCTOR, NULL_TREE,
  1215.                     nreverse ($3)); 
  1216.           if (pedantic)
  1217.             pedwarn ("ANSI C++ forbids constructor-expressions");
  1218.           /* Indicate that this was a GNU C constructor expression.  */
  1219.           TREE_HAS_CONSTRUCTOR (init) = 1;
  1220.  
  1221.           $$ = reparse_absdcl_as_casts ($$, init);
  1222.         }
  1223.     ;
  1224.  
  1225. expr_no_commas:
  1226.       cast_expr
  1227.     /* Handle general members.  */
  1228.     | expr_no_commas POINTSAT_STAR expr_no_commas
  1229.         { $$ = build_x_binary_op (MEMBER_REF, $$, $3); }
  1230.     | expr_no_commas DOT_STAR expr_no_commas
  1231.         { $$ = build_m_component_ref ($$, $3); }
  1232.     | expr_no_commas '+' expr_no_commas
  1233.         { $$ = build_x_binary_op ($2, $$, $3); }
  1234.     | expr_no_commas '-' expr_no_commas
  1235.         { $$ = build_x_binary_op ($2, $$, $3); }
  1236.     | expr_no_commas '*' expr_no_commas
  1237.         { $$ = build_x_binary_op ($2, $$, $3); }
  1238.     | expr_no_commas '/' expr_no_commas
  1239.         { $$ = build_x_binary_op ($2, $$, $3); }
  1240.     | expr_no_commas '%' expr_no_commas
  1241.         { $$ = build_x_binary_op ($2, $$, $3); }
  1242.     | expr_no_commas LSHIFT expr_no_commas
  1243.         { $$ = build_x_binary_op ($2, $$, $3); }
  1244.     | expr_no_commas RSHIFT expr_no_commas
  1245.         { $$ = build_x_binary_op ($2, $$, $3); }
  1246.     | expr_no_commas ARITHCOMPARE expr_no_commas
  1247.         { $$ = build_x_binary_op ($2, $$, $3); }
  1248.     | expr_no_commas '<' expr_no_commas
  1249.         { $$ = build_x_binary_op (LT_EXPR, $$, $3); }
  1250.     | expr_no_commas '>' expr_no_commas
  1251.         { $$ = build_x_binary_op (GT_EXPR, $$, $3); }
  1252.     | expr_no_commas EQCOMPARE expr_no_commas
  1253.         { $$ = build_x_binary_op ($2, $$, $3); }
  1254.     | expr_no_commas MIN_MAX expr_no_commas
  1255.         { $$ = build_x_binary_op ($2, $$, $3); }
  1256.     | expr_no_commas '&' expr_no_commas
  1257.         { $$ = build_x_binary_op ($2, $$, $3); }
  1258.     | expr_no_commas '|' expr_no_commas
  1259.         { $$ = build_x_binary_op ($2, $$, $3); }
  1260.     | expr_no_commas '^' expr_no_commas
  1261.         { $$ = build_x_binary_op ($2, $$, $3); }
  1262.     | expr_no_commas ANDAND expr_no_commas
  1263.         { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); }
  1264.     | expr_no_commas OROR expr_no_commas
  1265.         { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); }
  1266.     | expr_no_commas '?' xexpr ':' expr_no_commas
  1267.         { $$ = build_x_conditional_expr ($$, $3, $5); }
  1268.     | expr_no_commas '=' expr_no_commas
  1269.         { $$ = build_modify_expr ($$, NOP_EXPR, $3);
  1270.                   C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); }
  1271.     | expr_no_commas ASSIGN expr_no_commas
  1272.         { register tree rval;
  1273.           if ((rval = build_opfncall (MODIFY_EXPR, LOOKUP_NORMAL, $$, $3,
  1274.                          make_node ($2))))
  1275.             $$ = rval;
  1276.           else
  1277.             $$ = build_modify_expr ($$, $2, $3); }
  1278.     | THROW
  1279.         { $$ = build_throw (NULL_TREE); }
  1280.     | THROW expr_no_commas
  1281.         { $$ = build_throw ($2); }
  1282. /* These extensions are not defined.  The second arg to build_m_component_ref
  1283.    is old, build_m_component_ref now does an implicit
  1284.    build_indirect_ref (x, NULL_PTR) on the second argument.
  1285.     | object '&' expr_no_commas   %prec UNARY
  1286.         { $$ = build_m_component_ref ($$, build_x_unary_op (ADDR_EXPR, $3)); }
  1287.     | object unop expr_no_commas  %prec UNARY
  1288.         { $$ = build_m_component_ref ($$, build_x_unary_op ($2, $3)); }
  1289.     | object '(' type_id ')' expr_no_commas  %prec UNARY
  1290.         { tree type = groktypename ($3);
  1291.           $$ = build_m_component_ref ($$, build_c_cast (type, $5, 0)); }
  1292.     | object primary_no_id  %prec UNARY
  1293.         { $$ = build_m_component_ref ($$, $2); }
  1294. */
  1295.     ;
  1296.  
  1297. notype_unqualified_id:
  1298.       '~' see_typename identifier
  1299.         { $$ = build_parse_node (BIT_NOT_EXPR, $3); }
  1300.     | operator_name
  1301.     | IDENTIFIER
  1302.     | PTYPENAME
  1303.     | NSNAME %prec EMPTY
  1304.     ;
  1305.  
  1306. unqualified_id:
  1307.       notype_unqualified_id
  1308.     | TYPENAME
  1309.     ;
  1310.  
  1311. expr_or_declarator:
  1312.       notype_unqualified_id
  1313.     | '*' expr_or_declarator %prec UNARY
  1314.         { $$ = build_parse_node (INDIRECT_REF, $2); }
  1315.     | '&' expr_or_declarator %prec UNARY
  1316.         { $$ = build_parse_node (ADDR_EXPR, $2); }
  1317.     | '(' expr_or_declarator ')'
  1318.         { $$ = $2; }
  1319.     ;
  1320.  
  1321. direct_notype_declarator:
  1322.       complex_direct_notype_declarator
  1323.     | notype_unqualified_id
  1324.     | '(' expr_or_declarator ')'
  1325.         { $$ = finish_decl_parsing ($2); }
  1326.     ;
  1327.  
  1328. primary:
  1329.       notype_unqualified_id
  1330.         {
  1331.           if (TREE_CODE ($$) == BIT_NOT_EXPR)
  1332.             $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
  1333.           else if (IDENTIFIER_OPNAME_P ($$))
  1334.             {
  1335.               tree op = $$;
  1336.               $$ = lookup_name (op, 0);
  1337.               if ($$ == NULL_TREE)
  1338.             {
  1339.               if (op != ansi_opname[ERROR_MARK])
  1340.                 error ("operator %s not defined",
  1341.                    operator_name_string (op));
  1342.               $$ = error_mark_node;
  1343.             }
  1344.             }
  1345.           else
  1346.             $$ = do_identifier ($$);
  1347.         }        
  1348.     | CONSTANT
  1349.     | boolean.literal
  1350.     | string
  1351.         { $$ = combine_strings ($$); }
  1352.     | '(' expr ')'
  1353.         { char class;
  1354.           $$ = $2;
  1355.           class = TREE_CODE_CLASS (TREE_CODE ($$));
  1356.           if (class == 'e' || class == '1'
  1357.               || class == '2' || class == '<')
  1358.                     /* This inhibits warnings in truthvalue_conversion. */
  1359.             C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
  1360.     | '(' expr_or_declarator ')'
  1361.         { char class;
  1362.           $$ = reparse_decl_as_expr (NULL_TREE, $2);
  1363.           class = TREE_CODE_CLASS (TREE_CODE ($$));
  1364.           if (class == 'e' || class == '1'
  1365.               || class == '2' || class == '<')
  1366.                     /* This inhibits warnings in truthvalue_conversion. */
  1367.             C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
  1368.     | '(' error ')'
  1369.         { $$ = error_mark_node; }
  1370.     | '('
  1371.         { if (current_function_decl == 0)
  1372.             {
  1373.               error ("braced-group within expression allowed only inside a function");
  1374.               YYERROR;
  1375.             }
  1376.           keep_next_level ();
  1377.           $<ttype>$ = expand_start_stmt_expr (); }
  1378.       compstmt ')'
  1379.         { tree rtl_exp;
  1380.           if (pedantic)
  1381.             pedwarn ("ANSI C++ forbids braced-groups within expressions");
  1382.           rtl_exp = expand_end_stmt_expr ($<ttype>2);
  1383.           /* The statements have side effects, so the group does.  */
  1384.           TREE_SIDE_EFFECTS (rtl_exp) = 1;
  1385.  
  1386.           if (TREE_CODE ($3) == BLOCK)
  1387.             {
  1388.               /* Make a BIND_EXPR for the BLOCK already made.  */
  1389.               $$ = build (BIND_EXPR, TREE_TYPE (rtl_exp),
  1390.                   NULL_TREE, rtl_exp, $3);
  1391.               /* Remove the block from the tree at this point.
  1392.              It gets put back at the proper place
  1393.              when the BIND_EXPR is expanded.  */
  1394.               delete_block ($3);
  1395.             }
  1396.           else
  1397.             $$ = $3;
  1398.         }
  1399.     | primary '(' nonnull_exprlist ')'
  1400.                 { /* [eichin:19911016.1902EST] */
  1401.                   $<ttype>$ = build_x_function_call ($1, $3, current_class_decl); 
  1402.                   /* here we instantiate_class_template as needed... */
  1403.                   do_pending_templates ();
  1404.                 } template_instantiate_some {
  1405.                   if (TREE_CODE ($<ttype>5) == CALL_EXPR
  1406.                       && TREE_TYPE ($<ttype>5) != void_type_node)
  1407.                 $$ = require_complete_type ($<ttype>5);
  1408.                   else
  1409.                     $$ = $<ttype>5;
  1410.                 }
  1411.     | primary LEFT_RIGHT
  1412.                 {
  1413.           $$ = build_x_function_call ($$, NULL_TREE, current_class_decl);
  1414.           if (TREE_CODE ($$) == CALL_EXPR
  1415.               && TREE_TYPE ($$) != void_type_node)
  1416.             $$ = require_complete_type ($$);
  1417.                 }
  1418.     | primary '[' expr ']'
  1419.         { $$ = grok_array_decl ($$, $3); }
  1420.     | primary PLUSPLUS
  1421.         { /* If we get an OFFSET_REF, turn it into what it really
  1422.              means (e.g., a COMPONENT_REF).  This way if we've got,
  1423.              say, a reference to a static member that's being operated
  1424.              on, we don't end up trying to find a member operator for
  1425.              the class it's in.  */
  1426.           if (TREE_CODE ($$) == OFFSET_REF)
  1427.             $$ = resolve_offset_ref ($$);
  1428.           $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
  1429.     | primary MINUSMINUS
  1430.         { if (TREE_CODE ($$) == OFFSET_REF)
  1431.             $$ = resolve_offset_ref ($$);
  1432.           $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
  1433.     /* C++ extensions */
  1434.     | THIS
  1435.         { if (current_class_decl)
  1436.             {
  1437. #ifdef WARNING_ABOUT_CCD
  1438.               TREE_USED (current_class_decl) = 1;
  1439. #endif
  1440.               $$ = current_class_decl;
  1441.             }
  1442.           else if (current_function_decl
  1443.                && DECL_STATIC_FUNCTION_P (current_function_decl))
  1444.             {
  1445.               error ("`this' is unavailable for static member functions");
  1446.               $$ = error_mark_node;
  1447.             }
  1448.           else
  1449.             {
  1450.               if (current_function_decl)
  1451.             error ("invalid use of `this' in non-member function");
  1452.               else
  1453.             error ("invalid use of `this' at top level");
  1454.               $$ = error_mark_node;
  1455.             }
  1456.         }
  1457.     | TYPE_QUAL '(' nonnull_exprlist ')'
  1458.         {
  1459.           tree type;
  1460.           tree id = $$;
  1461.  
  1462.           /* This is a C cast in C++'s `functional' notation.  */
  1463.           if ($3 == error_mark_node)
  1464.             {
  1465.               $$ = error_mark_node;
  1466.               break;
  1467.             }
  1468. #if 0
  1469.           if ($3 == NULL_TREE)
  1470.             {
  1471.               error ("cannot cast null list to type `%s'",
  1472.                      IDENTIFIER_POINTER (TYPE_NAME (id)));
  1473.               $$ = error_mark_node;
  1474.               break;
  1475.             }
  1476. #endif
  1477. #if 0
  1478.           /* type is not set! (mrs) */
  1479.           if (type == error_mark_node)
  1480.             $$ = error_mark_node;
  1481.           else
  1482. #endif
  1483.             {
  1484.               if (id == ridpointers[(int) RID_CONST])
  1485.                 type = build_type_variant (integer_type_node, 1, 0);
  1486.               else if (id == ridpointers[(int) RID_VOLATILE])
  1487.                 type = build_type_variant (integer_type_node, 0, 1);
  1488. #if 0
  1489.               /* should not be able to get here (mrs) */
  1490.               else if (id == ridpointers[(int) RID_FRIEND])
  1491.                 {
  1492.                   error ("cannot cast expression to `friend' type");
  1493.                   $$ = error_mark_node;
  1494.                   break;
  1495.                 }
  1496. #endif
  1497.               else my_friendly_abort (79);
  1498.               $$ = build_c_cast (type, build_compound_expr ($3), 1);
  1499.             }
  1500.         }
  1501.     | functional_cast
  1502.     | DYNAMIC_CAST '<'
  1503.         { dont_allow_type_definitions = "inside dynamic_cast"; }
  1504.       type_id '>'
  1505.         { dont_allow_type_definitions = 0; }
  1506.       '(' expr ')'
  1507.         { tree type = groktypename ($4);
  1508.           $$ = build_dynamic_cast (type, $8); }
  1509.     | STATIC_CAST '<'
  1510.         { dont_allow_type_definitions = "inside static_cast"; }
  1511.       type_id '>'
  1512.         { dont_allow_type_definitions = 0; }
  1513.       '(' expr ')'
  1514.         { tree type = groktypename ($4);
  1515.           $$ = build_static_cast (type, $8); }
  1516.     | REINTERPRET_CAST '<'
  1517.         { dont_allow_type_definitions = "inside reinterpret_cast"; }
  1518.       type_id '>'
  1519.         { dont_allow_type_definitions = 0; }
  1520.       '(' expr ')'
  1521.         { tree type = groktypename ($4);
  1522.           $$ = build_reinterpret_cast (type, $8); }
  1523.     | CONST_CAST '<'
  1524.         { dont_allow_type_definitions = "inside const_cast"; }
  1525.       type_id '>'
  1526.         { dont_allow_type_definitions = 0; }
  1527.       '(' expr ')'
  1528.         { tree type = groktypename ($4);
  1529.           $$ = build_const_cast (type, $8); }
  1530.     | TYPEID '(' expr ')'
  1531.         { $$ = build_typeid ($3); }
  1532.     | TYPEID '(' type_id ')'
  1533.         { tree type = groktypename ($3);
  1534.           $$ = get_typeid (TYPE_MAIN_VARIANT (type)); }
  1535.     | global_scope IDENTIFIER
  1536.         {
  1537.         do_scoped_id:
  1538.           $$ = IDENTIFIER_GLOBAL_VALUE ($2);
  1539.           if (yychar == YYEMPTY)
  1540.             yychar = YYLEX;
  1541.           if (! $$)
  1542.             {
  1543.               if (yychar == '(' || yychar == LEFT_RIGHT)
  1544.             $$ = implicitly_declare ($2);
  1545.               else
  1546.             {
  1547.               if (IDENTIFIER_GLOBAL_VALUE ($2) != error_mark_node)
  1548.                 error ("undeclared variable `%s' (first use here)",
  1549.                    IDENTIFIER_POINTER ($2));
  1550.               $$ = error_mark_node;
  1551.               /* Prevent repeated error messages.  */
  1552.               IDENTIFIER_GLOBAL_VALUE ($2) = error_mark_node;
  1553.             }
  1554.             }
  1555.           else
  1556.             {
  1557.               if (TREE_CODE ($$) == ADDR_EXPR)
  1558.             assemble_external (TREE_OPERAND ($$, 0));
  1559.               else
  1560.             assemble_external ($$);
  1561.               TREE_USED ($$) = 1;
  1562.             }
  1563.           if (TREE_CODE ($$) == CONST_DECL)
  1564.             {
  1565.               /* XXX CHS - should we set TREE_USED of the constant? */
  1566.               $$ = DECL_INITIAL ($$);
  1567.               /* This is to prevent an enum whose value is 0
  1568.              from being considered a null pointer constant.  */
  1569.               $$ = build1 (NOP_EXPR, TREE_TYPE ($$), $$);
  1570.               TREE_CONSTANT ($$) = 1;
  1571.             }
  1572.  
  1573.         }
  1574.     | global_scope operator_name
  1575.         {
  1576.           got_scope = NULL_TREE;
  1577.           if (TREE_CODE ($2) == IDENTIFIER_NODE)
  1578.             goto do_scoped_id;
  1579.           $$ = $2;
  1580.         }
  1581.     | overqualified_id %prec HYPERUNARY
  1582.         { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); }
  1583.     | overqualified_id '(' nonnull_exprlist ')'
  1584.         { $$ = build_member_call (OP0 ($$), OP1 ($$), $3); }
  1585.     | overqualified_id LEFT_RIGHT
  1586.         { $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); }
  1587.     | object unqualified_id  %prec UNARY
  1588.         { got_object = NULL_TREE;
  1589.           $$ = build_component_ref ($$, $2, NULL_TREE, 1); }
  1590.     | object overqualified_id %prec UNARY
  1591.         { got_object = NULL_TREE;
  1592.           $$ = build_object_ref ($$, OP0 ($2), OP1 ($2)); }
  1593.     | object unqualified_id '(' nonnull_exprlist ')'
  1594.         {
  1595.           got_object = NULL_TREE;
  1596. #if 0
  1597.           /* This is a future direction of this code, but because
  1598.              build_x_function_call cannot always undo what is done
  1599.              in build_component_ref entirely yet, we cannot do this. */
  1600.           $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, $$);
  1601.           if (TREE_CODE ($$) == CALL_EXPR
  1602.               && TREE_TYPE ($$) != void_type_node)
  1603.             $$ = require_complete_type ($$);
  1604. #else
  1605.           $$ = build_method_call ($$, $2, $4, NULL_TREE,
  1606.                       (LOOKUP_NORMAL|LOOKUP_AGGR));
  1607. #endif
  1608.         }
  1609.     | object unqualified_id LEFT_RIGHT
  1610.         {
  1611.           got_object = NULL_TREE;
  1612. #if 0
  1613.           /* This is a future direction of this code, but because
  1614.              build_x_function_call cannot always undo what is done
  1615.              in build_component_ref entirely yet, we cannot do this. */
  1616.           $$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, $$);
  1617.           if (TREE_CODE ($$) == CALL_EXPR
  1618.               && TREE_TYPE ($$) != void_type_node)
  1619.             $$ = require_complete_type ($$);
  1620. #else
  1621.           $$ = build_method_call ($$, $2, NULL_TREE, NULL_TREE,
  1622.                       (LOOKUP_NORMAL|LOOKUP_AGGR));
  1623. #endif
  1624.         }
  1625.     | object overqualified_id '(' nonnull_exprlist ')'
  1626.         {
  1627.           got_object = NULL_TREE;
  1628.           if (IS_SIGNATURE (IDENTIFIER_TYPE_VALUE (OP0 ($2))))
  1629.             {
  1630.               warning ("signature name in scope resolution ignored");
  1631.               $$ = build_method_call ($$, OP1 ($2), $4, NULL_TREE,
  1632.                           (LOOKUP_NORMAL|LOOKUP_AGGR));
  1633.             }
  1634.           else
  1635.             $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), $4);
  1636.         }
  1637.     | object overqualified_id LEFT_RIGHT
  1638.         {
  1639.           got_object = NULL_TREE;
  1640.           if (IS_SIGNATURE (IDENTIFIER_TYPE_VALUE (OP0 ($2))))
  1641.             {
  1642.               warning ("signature name in scope resolution ignored");
  1643.               $$ = build_method_call ($$, OP1 ($2), NULL_TREE, NULL_TREE,
  1644.                           (LOOKUP_NORMAL|LOOKUP_AGGR));
  1645.             }
  1646.           else
  1647.             $$ = build_scoped_method_call ($$, OP0 ($2), OP1 ($2), NULL_TREE);
  1648.         }
  1649.     /* p->int::~int() is valid -- 12.4 */
  1650.     | object '~' TYPESPEC LEFT_RIGHT
  1651.         {
  1652.           got_object = NULL_TREE;
  1653.           if (IDENTIFIER_GLOBAL_VALUE ($3)
  1654.               && (TREE_CODE (TREE_TYPE ($1)) 
  1655.               != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($3)))))
  1656.             cp_error ("`%E' is not of type `%T'", $1, $3);
  1657.           $$ = convert (void_type_node, $1);
  1658.         }
  1659.     | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT
  1660.         {
  1661.           got_object = NULL_TREE;
  1662.           if ($2 != $5)
  1663.             cp_error ("destructor specifier `%T::~%T()' must have matching names", $2, $5);
  1664.           if (TREE_CODE (TREE_TYPE ($1))
  1665.               != TREE_CODE (TREE_TYPE (IDENTIFIER_GLOBAL_VALUE ($2))))
  1666.             cp_error ("`%E' is not of type `%T'", $1, $2);
  1667.           $$ = convert (void_type_node, $1);
  1668.         }
  1669.     | object error
  1670.         {
  1671.           got_object = NULL_TREE;
  1672.           $$ = error_mark_node;
  1673.         }
  1674.     ;
  1675.  
  1676. /* Not needed for now.
  1677.  
  1678. primary_no_id:
  1679.       '(' expr ')'
  1680.         { $$ = $2; }
  1681.     | '(' error ')'
  1682.         { $$ = error_mark_node; }
  1683.     | '('
  1684.         { if (current_function_decl == 0)
  1685.             {
  1686.               error ("braced-group within expression allowed only inside a function");
  1687.               YYERROR;
  1688.             }
  1689.           $<ttype>$ = expand_start_stmt_expr (); }
  1690.       compstmt ')'
  1691.         { if (pedantic)
  1692.             pedwarn ("ANSI C++ forbids braced-groups within expressions");
  1693.           $$ = expand_end_stmt_expr ($<ttype>2); }
  1694.     | primary_no_id '(' nonnull_exprlist ')'
  1695.         { $$ = build_x_function_call ($$, $3, current_class_decl); }
  1696.     | primary_no_id LEFT_RIGHT
  1697.         { $$ = build_x_function_call ($$, NULL_TREE, current_class_decl); }
  1698.     | primary_no_id '[' expr ']'
  1699.         { goto do_array; }
  1700.     | primary_no_id PLUSPLUS
  1701.         { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); }
  1702.     | primary_no_id MINUSMINUS
  1703.         { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); }
  1704.     | SCOPE IDENTIFIER
  1705.         { goto do_scoped_id; }
  1706.     | SCOPE operator_name
  1707.         { if (TREE_CODE ($2) == IDENTIFIER_NODE)
  1708.             goto do_scoped_id;
  1709.           goto do_scoped_operator;
  1710.         }
  1711.     ;
  1712. */
  1713.  
  1714. new:      NEW
  1715.         { $$ = 0; }
  1716.     | global_scope NEW
  1717.         { got_scope = NULL_TREE; $$ = 1; }
  1718.     ;
  1719.  
  1720. delete:      DELETE
  1721.         { $$ = 0; }
  1722.     | global_scope delete
  1723.         { got_scope = NULL_TREE; $$ = 1; }
  1724.     ;
  1725.  
  1726. boolean.literal:
  1727.       CXX_TRUE
  1728.         { $$ = boolean_true_node; }
  1729.     | CXX_FALSE
  1730.         { $$ = boolean_false_node; }
  1731.     ;
  1732.  
  1733. /* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it.  */
  1734. string:
  1735.       STRING
  1736.     | string STRING
  1737.         { $$ = chainon ($$, $2); }
  1738.     ;
  1739.  
  1740. nodecls:
  1741.       /* empty */
  1742.         {
  1743.           if (! current_function_parms_stored)
  1744.             store_parm_decls ();
  1745.           setup_vtbl_ptr ();
  1746.           /* Always keep the BLOCK node associated with the outermost
  1747.              pair of curley braces of a function.  These are needed
  1748.              for correct operation of dwarfout.c.  */
  1749.           keep_next_level ();
  1750.         }
  1751.     ;
  1752.  
  1753. object:      primary '.'
  1754.         { got_object = TREE_TYPE ($$); }
  1755.     | primary POINTSAT
  1756.         {
  1757.           $$ = build_x_arrow ($$); 
  1758.           got_object = TREE_TYPE ($$);
  1759.         }
  1760.     ;
  1761.  
  1762. decl:
  1763.     /* Normal case: make this fast.  */
  1764.       typespec declarator ';'
  1765.         { tree d = get_decl_list ($1);
  1766.           int yes = suspend_momentary ();
  1767.           d = start_decl ($2, d, 0, NULL_TREE);
  1768.           cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
  1769.           resume_momentary (yes);
  1770.           if (IS_AGGR_TYPE_CODE (TREE_CODE ($1)))
  1771.             note_got_semicolon ($1);
  1772.         }
  1773.     | typed_declspecs declarator ';'
  1774.         { tree d, specs, attrs;
  1775.           int yes;
  1776.           split_specs_attrs ($1, &specs, &attrs);
  1777.           yes = suspend_momentary ();
  1778.           d = start_decl ($2, specs, 0, NULL_TREE);
  1779.           cplus_decl_attributes (d, NULL_TREE, attrs);
  1780.           cp_finish_decl (d, NULL_TREE, NULL_TREE, 0, 0);
  1781.           resume_momentary (yes);
  1782.           note_list_got_semicolon ($1);
  1783.         }
  1784.     | typespec initdecls ';'
  1785.         {
  1786.           resume_momentary ($2);
  1787.           if (IS_AGGR_TYPE_CODE (TREE_CODE ($1)))
  1788.             note_got_semicolon ($1);
  1789.         }
  1790.     | typed_declspecs initdecls ';'
  1791.         {
  1792.           resume_momentary ($2);
  1793.           note_list_got_semicolon ($1);
  1794.         }
  1795.     | declmods notype_initdecls ';'
  1796.         { resume_momentary ($2); }
  1797.     | typed_declspecs ';'
  1798.         {
  1799.           shadow_tag ($1);
  1800.           note_list_got_semicolon ($1);
  1801.         }
  1802.     | declmods ';'
  1803.         { warning ("empty declaration"); }
  1804.     ;
  1805.  
  1806. /* Any kind of declarator (thus, all declarators allowed
  1807.    after an explicit typespec).  */
  1808.  
  1809. declarator:
  1810.       after_type_declarator %prec EMPTY
  1811.     | notype_declarator %prec EMPTY
  1812.     ;
  1813.  
  1814. /* This is necessary to postpone reduction of `int()()()()'.  */
  1815. fcast_or_absdcl:
  1816.       LEFT_RIGHT %prec EMPTY
  1817.         { $$ = build_parse_node (CALL_EXPR, NULL_TREE, empty_parms (),
  1818.                      NULL_TREE); }
  1819.     | fcast_or_absdcl LEFT_RIGHT %prec EMPTY
  1820.         { $$ = build_parse_node (CALL_EXPR, $$, empty_parms (), 
  1821.                      NULL_TREE); }
  1822.     ;
  1823.  
  1824. /* ANSI type-id (8.1) */
  1825. type_id:
  1826.       typed_typespecs absdcl
  1827.         { $$ = build_decl_list ($$, $2); }
  1828.     | nonempty_type_quals absdcl
  1829.         { $$ = build_decl_list ($$, $2); }
  1830.     | typespec absdcl
  1831.         { $$ = build_decl_list (get_decl_list ($$), $2); }
  1832.     | typed_typespecs %prec EMPTY
  1833.         { $$ = build_decl_list ($$, NULL_TREE); }
  1834.     | nonempty_type_quals %prec EMPTY
  1835.         { $$ = build_decl_list ($$, NULL_TREE); }
  1836.     ;
  1837.  
  1838. /* Declspecs which contain at least one type specifier or typedef name.
  1839.    (Just `const' or `volatile' is not enough.)
  1840.    A typedef'd name following these is taken as a name to be declared.
  1841.    In the result, declspecs have a non-NULL TREE_VALUE, attributes do not.  */
  1842.  
  1843. typed_declspecs:
  1844.       typed_typespecs %prec EMPTY
  1845.     | typed_declspecs1
  1846.     ;
  1847.  
  1848. typed_declspecs1:
  1849.       declmods typespec
  1850.         { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
  1851.     | typespec reserved_declspecs    %prec HYPERUNARY
  1852.         { $$ = decl_tree_cons (NULL_TREE, $$, $2); }
  1853.     | typespec reserved_typespecquals reserved_declspecs
  1854.         { $$ = decl_tree_cons (NULL_TREE, $$, chainon ($2, $3)); }
  1855.     | declmods typespec reserved_declspecs
  1856.         { $$ = decl_tree_cons (NULL_TREE, $2, chainon ($3, $$)); }
  1857.     | declmods typespec reserved_typespecquals
  1858.         { $$ = decl_tree_cons (NULL_TREE, $2, chainon ($3, $$)); }
  1859.     | declmods typespec reserved_typespecquals reserved_declspecs
  1860.         { $$ = decl_tree_cons (NULL_TREE, $2, 
  1861.                        chainon ($3, chainon ($4, $$))); }
  1862.     ;
  1863.  
  1864. reserved_declspecs:
  1865.       SCSPEC
  1866.         { if (extra_warnings)
  1867.             warning ("`%s' is not at beginning of declaration",
  1868.                  IDENTIFIER_POINTER ($$));
  1869.           $$ = build_decl_list (NULL_TREE, $$); }
  1870.     | reserved_declspecs typespecqual_reserved
  1871.         { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
  1872.     | reserved_declspecs SCSPEC
  1873.         { if (extra_warnings)
  1874.             warning ("`%s' is not at beginning of declaration",
  1875.                  IDENTIFIER_POINTER ($2));
  1876.           $$ = decl_tree_cons (NULL_TREE, $2, $$); }
  1877.     | reserved_declspecs attributes
  1878.         { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
  1879.     | attributes
  1880.         { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
  1881.     ;
  1882.  
  1883. /* List of just storage classes and type modifiers.
  1884.    A declaration can start with just this, but then it cannot be used
  1885.    to redeclare a typedef-name.
  1886.    In the result, declspecs have a non-NULL TREE_VALUE, attributes do not.  */
  1887.  
  1888. declmods:
  1889.       nonempty_type_quals %prec EMPTY
  1890.         { TREE_STATIC ($$) = 1; }
  1891.     | SCSPEC
  1892.         { $$ = IDENTIFIER_AS_LIST ($$); }
  1893. ifwin32
  1894.     | declspec
  1895.         { $$ = decl_tree_cons (NULL_TREE, $1, NULL_TREE); }
  1896. end ifwin32
  1897.     | declmods TYPE_QUAL
  1898.         { $$ = decl_tree_cons (NULL_TREE, $2, $$);
  1899.           TREE_STATIC ($$) = 1; }
  1900.     | declmods SCSPEC
  1901.         { if (extra_warnings && TREE_STATIC ($$))
  1902.             warning ("`%s' is not at beginning of declaration",
  1903.                  IDENTIFIER_POINTER ($2));
  1904.           $$ = decl_tree_cons (NULL_TREE, $2, $$);
  1905.           TREE_STATIC ($$) = TREE_STATIC ($1); }
  1906. ifwin32
  1907.     | declmods declspec
  1908.         { $$ = decl_tree_cons (NULL_TREE, $2, $1); }
  1909. end ifwin32
  1910.     | declmods attributes
  1911.         { $$ = decl_tree_cons ($2, NULL_TREE, $1); }
  1912.     | attributes
  1913.         { $$ = decl_tree_cons ($1, NULL_TREE, NULL_TREE); }
  1914.     ;
  1915.  
  1916. /* Used instead of declspecs where storage classes are not allowed
  1917.    (that is, for typenames and structure components).
  1918.  
  1919.    C++ can takes storage classes for structure components.
  1920.    Don't accept a typedef-name if anything but a modifier precedes it.  */
  1921.  
  1922. typed_typespecs:
  1923.       typespec  %prec EMPTY
  1924.         { $$ = get_decl_list ($$); }
  1925.     | nonempty_type_quals typespec
  1926.         { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
  1927.     | typespec reserved_typespecquals
  1928.         { $$ = decl_tree_cons (NULL_TREE, $$, $2); }
  1929.     | nonempty_type_quals typespec reserved_typespecquals
  1930.         { $$ = decl_tree_cons (NULL_TREE, $2, chainon ($3, $$)); }
  1931.     ;
  1932.  
  1933. reserved_typespecquals:
  1934.       typespecqual_reserved
  1935.         { $$ = build_decl_list (NULL_TREE, $$); }
  1936.     | reserved_typespecquals typespecqual_reserved
  1937.         { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
  1938.     ;
  1939.  
  1940. /* A typespec (but not a type qualifier).
  1941.    Once we have seen one of these in a declaration,
  1942.    if a typedef name appears then it is being redeclared.  */
  1943.  
  1944. typespec: structsp
  1945.     | TYPESPEC  %prec EMPTY
  1946.     | complete_type_name
  1947.     | TYPEOF '(' expr ')'
  1948.         { $$ = TREE_TYPE ($3);
  1949.           if (pedantic && !in_system_header)
  1950.             pedwarn ("ANSI C++ forbids `typeof'"); }
  1951.     | TYPEOF '(' type_id ')'
  1952.         { $$ = groktypename ($3);
  1953.           if (pedantic && !in_system_header)
  1954.             pedwarn ("ANSI C++ forbids `typeof'"); }
  1955.     | SIGOF '(' expr ')'
  1956.         { tree type = TREE_TYPE ($3);
  1957.  
  1958.           if (IS_AGGR_TYPE (type))
  1959.             {
  1960.               sorry ("sigof type specifier");
  1961.               $$ = type;
  1962.             }
  1963.           else
  1964.             {
  1965.               error ("`sigof' applied to non-aggregate expression");
  1966.               $$ = error_mark_node;
  1967.             }
  1968.         }
  1969.     | SIGOF '(' type_id ')'
  1970.         { tree type = groktypename ($3);
  1971.  
  1972.           if (IS_AGGR_TYPE (type))
  1973.             {
  1974.               sorry ("sigof type specifier");
  1975.               $$ = type;
  1976.             }
  1977.           else
  1978.             {
  1979.               error("`sigof' applied to non-aggregate type");
  1980.               $$ = error_mark_node;
  1981.             }
  1982.         }
  1983.     ;
  1984.  
  1985. /* A typespec that is a reserved word, or a type qualifier.  */
  1986.  
  1987. typespecqual_reserved: TYPESPEC
  1988.     | TYPE_QUAL
  1989.     | structsp
  1990.     ;
  1991.  
  1992. initdecls:
  1993.       initdcl0
  1994.     | initdecls ',' initdcl
  1995.     ;
  1996.  
  1997. notype_initdecls:
  1998.       notype_initdcl0
  1999.     | notype_initdecls ',' initdcl
  2000.     ;
  2001.  
  2002. nomods_initdecls:
  2003.       nomods_initdcl0
  2004.     | nomods_initdecls ',' initdcl
  2005.     ;
  2006.  
  2007. maybeasm:
  2008.       /* empty */
  2009.         { $$ = NULL_TREE; }
  2010.     | asm_keyword '(' string ')'
  2011.         { if (TREE_CHAIN ($3)) $3 = combine_strings ($3); $$ = $3; }
  2012.     ;
  2013.  
  2014. initdcl0:
  2015.       declarator exception_specification_opt maybeasm maybe_attribute '='
  2016.         { split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2017.                      &prefix_attributes);
  2018.           if (TREE_CODE (current_declspecs) != TREE_LIST)
  2019.             current_declspecs = get_decl_list (current_declspecs);
  2020.           if (have_extern_spec && !used_extern_spec)
  2021.             {
  2022.               current_declspecs = decl_tree_cons
  2023.             (NULL_TREE, get_identifier ("extern"), 
  2024.              current_declspecs);
  2025.               used_extern_spec = 1;
  2026.             }
  2027.           $<itype>5 = suspend_momentary ();
  2028.           $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1, $2);
  2029.           cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
  2030.       init
  2031. /* Note how the declaration of the variable is in effect while its init is parsed! */
  2032.         { cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING);
  2033.           $$ = $<itype>5; }
  2034.     | declarator exception_specification_opt maybeasm maybe_attribute
  2035.         { tree d;
  2036.           split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2037.                      &prefix_attributes);
  2038.           if (TREE_CODE (current_declspecs) != TREE_LIST)
  2039.             current_declspecs = get_decl_list (current_declspecs);
  2040.           if (have_extern_spec && !used_extern_spec)
  2041.             {
  2042.               current_declspecs = decl_tree_cons
  2043.             (NULL_TREE, get_identifier ("extern"), 
  2044.              current_declspecs);
  2045.               used_extern_spec = 1;
  2046.             }
  2047.           $$ = suspend_momentary ();
  2048.           d = start_decl ($<ttype>1, current_declspecs, 0, $2);
  2049.           cplus_decl_attributes (d, $4, prefix_attributes);
  2050.           cp_finish_decl (d, NULL_TREE, $3, 0, 0); }
  2051.     ;
  2052.  
  2053. initdcl:
  2054.       declarator exception_specification_opt maybeasm maybe_attribute '='
  2055.         { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1, $2);
  2056.           cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
  2057.       init
  2058. /* Note how the declaration of the variable is in effect while its init is parsed! */
  2059.         { cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING); }
  2060.     | declarator exception_specification_opt maybeasm maybe_attribute
  2061.         { $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 0, $2);
  2062.           cplus_decl_attributes ($<ttype>$, $4, prefix_attributes);
  2063.           cp_finish_decl ($<ttype>$, NULL_TREE, $3, 0, 0); }
  2064.     ;
  2065.  
  2066. notype_initdcl0:
  2067.       notype_declarator exception_specification_opt maybeasm maybe_attribute '='
  2068.         { split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2069.                      &prefix_attributes);
  2070.           $<itype>5 = suspend_momentary ();
  2071.           $<ttype>$ = start_decl ($<ttype>1, current_declspecs, 1, $2);
  2072.           cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
  2073.       init
  2074. /* Note how the declaration of the variable is in effect while its init is parsed! */
  2075.         { cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING);
  2076.           $$ = $<itype>5; }
  2077.     | notype_declarator exception_specification_opt maybeasm maybe_attribute
  2078.         { tree d;
  2079.           split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2080.                      &prefix_attributes);
  2081.           $$ = suspend_momentary ();
  2082.           d = start_decl ($<ttype>1, current_declspecs, 0, $2);
  2083.           cplus_decl_attributes (d, $4, prefix_attributes);
  2084.           cp_finish_decl (d, NULL_TREE, $3, 0, 0); }
  2085.     ;
  2086.  
  2087. nomods_initdcl0:
  2088.       notype_declarator exception_specification_opt maybeasm maybe_attribute '='
  2089.         { current_declspecs = NULL_TREE;
  2090.           prefix_attributes = NULL_TREE;
  2091.           $<itype>5 = suspend_momentary ();
  2092.           $<ttype>$ = start_decl ($1, current_declspecs, 1, $2);
  2093.           cplus_decl_attributes ($<ttype>$, $4, prefix_attributes); }
  2094.       init
  2095. /* Note how the declaration of the variable is in effect while its init is parsed! */
  2096.         { cp_finish_decl ($<ttype>6, $7, $3, 0, LOOKUP_ONLYCONVERTING);
  2097.           $$ = $<itype>5; }
  2098.     | notype_declarator exception_specification_opt maybeasm maybe_attribute
  2099.         { tree d;
  2100.           current_declspecs = NULL_TREE;
  2101.           prefix_attributes = NULL_TREE;
  2102.           $$ = suspend_momentary ();
  2103.           d = start_decl ($1, current_declspecs, 0, $2);
  2104.           cplus_decl_attributes (d, $4, prefix_attributes);
  2105.           cp_finish_decl (d, NULL_TREE, $3, 0, 0); }
  2106.     ;
  2107.  
  2108. /* the * rules are dummies to accept the Apollo extended syntax
  2109.    so that the header files compile. */
  2110. maybe_attribute:
  2111.       /* empty */
  2112.           { $$ = NULL_TREE; }
  2113.     | attributes
  2114.         { $$ = $1; }
  2115.     ;
  2116.  
  2117. attributes:
  2118.       attribute
  2119.         { $$ = $1; }
  2120.     | attributes attribute
  2121.         { $$ = chainon ($1, $2); }
  2122.     ;
  2123.  
  2124. attribute:
  2125.       ATTRIBUTE '(' '(' attribute_list ')' ')'
  2126.         { $$ = $4; }
  2127.     ;
  2128.  
  2129. attribute_list:
  2130.       attrib
  2131.         { $$ = $1; }
  2132.     | attribute_list ',' attrib
  2133.         { $$ = chainon ($1, $3); }
  2134.     ;
  2135.  
  2136. attrib:
  2137.     /* empty */
  2138.         { $$ = NULL_TREE; }
  2139.     | any_word
  2140.         { $$ = build_tree_list ($1, NULL_TREE); }
  2141.     | any_word '(' IDENTIFIER ')'
  2142.         { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); }
  2143.     | any_word '(' IDENTIFIER ',' nonnull_exprlist ')'
  2144.         { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); }
  2145.     | any_word '(' nonnull_exprlist ')'
  2146.         { $$ = build_tree_list ($1, $3); }
  2147.     ;
  2148.  
  2149. /* This still leaves out most reserved keywords,
  2150.    shouldn't we include them?  */
  2151.  
  2152. any_word:
  2153.       identifier
  2154.     | SCSPEC
  2155.     | TYPESPEC
  2156.     | TYPE_QUAL
  2157.     ;
  2158.  
  2159. /* A nonempty list of identifiers, including typenames.  */
  2160. identifiers_or_typenames:
  2161.     identifier
  2162.         { $$ = build_tree_list (NULL_TREE, $1); }
  2163.     | identifiers_or_typenames ',' identifier
  2164.         { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }
  2165.     ;
  2166.  
  2167. maybe_init:
  2168.     %prec EMPTY /* empty */
  2169.         { $$ = NULL_TREE; }
  2170.     | '=' init
  2171.         { $$ = $2; }
  2172.  
  2173. init:
  2174.       expr_no_commas %prec '='
  2175.     | '{' '}'
  2176.         { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE);
  2177.           TREE_HAS_CONSTRUCTOR ($$) = 1; }
  2178.     | '{' initlist '}'
  2179.         { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
  2180.           TREE_HAS_CONSTRUCTOR ($$) = 1; }
  2181.     | '{' initlist ',' '}'
  2182.         { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2));
  2183.           TREE_HAS_CONSTRUCTOR ($$) = 1; }
  2184.     | error
  2185.         { $$ = NULL_TREE; }
  2186.     ;
  2187.  
  2188. /* This chain is built in reverse order,
  2189.    and put in forward order where initlist is used.  */
  2190. initlist:
  2191.       init
  2192.         { $$ = build_tree_list (NULL_TREE, $$); }
  2193.     | initlist ',' init
  2194.         { $$ = tree_cons (NULL_TREE, $3, $$); }
  2195.     /* These are for labeled elements.  */
  2196.     | '[' expr_no_commas ']' init
  2197.         { $$ = build_tree_list ($2, $4); }
  2198.     | initlist ',' CASE expr_no_commas ':' init
  2199.         { $$ = tree_cons ($4, $6, $$); }
  2200.     | identifier ':' init
  2201.         { $$ = build_tree_list ($$, $3); }
  2202.     | initlist ',' identifier ':' init
  2203.         { $$ = tree_cons ($3, $5, $$); }
  2204.     ;
  2205.  
  2206. structsp:
  2207.       ENUM identifier '{'
  2208.         { $<itype>3 = suspend_momentary ();
  2209.           $$ = start_enum ($2); }
  2210.       enumlist maybecomma_warn '}'
  2211.         { $$ = finish_enum ($<ttype>4, $5);
  2212.           resume_momentary ((int) $<itype>3);
  2213.           check_for_missing_semicolon ($<ttype>4); }
  2214.     | ENUM identifier '{' '}'
  2215.         { $$ = finish_enum (start_enum ($2), NULL_TREE);
  2216.           check_for_missing_semicolon ($$); }
  2217.     | ENUM '{'
  2218.         { $<itype>2 = suspend_momentary ();
  2219.           $$ = start_enum (make_anon_name ()); }
  2220.       enumlist maybecomma_warn '}'
  2221.         { $$ = finish_enum ($<ttype>3, $4);
  2222.           resume_momentary ((int) $<itype>1);
  2223.           check_for_missing_semicolon ($<ttype>3); }
  2224.     | ENUM '{' '}'
  2225.         { $$ = finish_enum (start_enum (make_anon_name()), NULL_TREE);
  2226.           check_for_missing_semicolon ($$); }
  2227.     | ENUM identifier
  2228.         { $$ = xref_tag (enum_type_node, $2, NULL_TREE, 1); }
  2229.     | ENUM complex_type_name
  2230.         { $$ = xref_tag (enum_type_node, $2, NULL_TREE, 1); }
  2231.     | TYPENAME_KEYWORD complex_type_name
  2232.         { $$ = $2; }
  2233.     /* C++ extensions, merged with C to avoid shift/reduce conflicts */
  2234.     | class_head left_curly opt.component_decl_list '}'
  2235.         {
  2236.           int semi;
  2237.           tree id;
  2238.  
  2239. #if 0
  2240.           /* Need to rework class nesting in the
  2241.              presence of nested classes, etc.  */
  2242.           shadow_tag (CLASSTYPE_AS_LIST ($$)); */
  2243. #endif
  2244.           if (yychar == YYEMPTY)
  2245.             yychar = YYLEX;
  2246.           semi = yychar == ';';
  2247.           /* finish_struct nukes this anyway; if
  2248.              finish_exception does too, then it can go. */
  2249.           if (semi)
  2250.             note_got_semicolon ($$);
  2251.  
  2252.           if (TREE_CODE ($$) == ENUMERAL_TYPE)
  2253.             /* $$ = $1 from default rule.  */;
  2254.           else
  2255.             {
  2256.               $$ = finish_struct ($$, $3, semi);
  2257.               if (semi) note_got_semicolon ($$);
  2258.             }
  2259.  
  2260.           pop_obstacks ();
  2261.  
  2262.           id = TYPE_IDENTIFIER ($$);
  2263.           if (id && IDENTIFIER_TEMPLATE (id))
  2264.             {
  2265.               tree decl;
  2266.  
  2267.               /* I don't know if the copying of this TYPE_DECL is
  2268.                * really needed.  However, it's such a small per-
  2269.                * formance penalty that the extra safety is a bargain.
  2270.                * - niklas@appli.se
  2271.                */
  2272.               push_obstacks (&permanent_obstack, &permanent_obstack);
  2273.               decl = copy_node (lookup_name (id, 0));
  2274.               if (DECL_LANG_SPECIFIC (decl))
  2275.             copy_lang_decl (decl);
  2276.               pop_obstacks ();
  2277.               undo_template_name_overload (id, 0);
  2278.               pushdecl_top_level (decl);
  2279.             }
  2280.           if (! semi)
  2281.             check_for_missing_semicolon ($$); }
  2282.     | class_head  %prec EMPTY
  2283.         {
  2284.           /* struct B: public A; is not accepted by the WP grammar.  */
  2285.           if (TYPE_BINFO_BASETYPES ($$) && !TYPE_SIZE ($$)
  2286.               && ! TYPE_BEING_DEFINED ($$))
  2287.             cp_error ("base clause without member specification for `%#T'",
  2288.                   $$);
  2289.         }
  2290.     ;
  2291.  
  2292. maybecomma:
  2293.       /* empty */
  2294.     | ','
  2295.     ;
  2296.  
  2297. maybecomma_warn:
  2298.       /* empty */
  2299.     | ','
  2300.         { if (pedantic) pedwarn ("comma at end of enumerator list"); }
  2301.     ;
  2302.  
  2303. aggr:      AGGR
  2304.     | aggr SCSPEC
  2305.         { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
  2306.     | aggr TYPESPEC
  2307.         { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
  2308.     | aggr TYPE_QUAL
  2309.         { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); }
  2310.     | aggr AGGR
  2311.         { error ("no body nor ';' separates two class, struct or union declarations"); }
  2312.     ;
  2313.  
  2314. specialization:
  2315.       aggr template_type_name ';'
  2316.         { 
  2317.           yyungetc (';', 1); current_aggr = $$; $$ = $2; 
  2318.           if ($<ttype>0 == ridpointers[(int) RID_TEMPLATE])
  2319.             instantiate_class_template ($$, 2);
  2320.         }
  2321.     ;
  2322.  
  2323. named_class_head_sans_basetype:
  2324.       aggr identifier
  2325.         { current_aggr = $$; $$ = $2; }
  2326.     | specialization
  2327.     ;
  2328.  
  2329. named_class_head_sans_basetype_defn:
  2330.       aggr identifier_defn %prec EMPTY
  2331.         { current_aggr = $$; $$ = $2; }
  2332.     | aggr template_type_name '{'
  2333.         { yyungetc ('{', 1);
  2334.         aggr2:
  2335.           current_aggr = $$;
  2336.           $$ = $2;
  2337.           overload_template_name ($$, 0); }
  2338.     | aggr template_type_name ':'
  2339.         { yyungetc (':', 1); goto aggr2; }
  2340.     ;
  2341.  
  2342. named_complex_class_head_sans_basetype:
  2343.       aggr nested_name_specifier identifier
  2344.         { current_aggr = $$; $$ = $3; }
  2345.     | aggr template_type %prec EMPTY
  2346.         { current_aggr = $$; $$ = $2; }
  2347.     ;
  2348.  
  2349. do_xref_defn: /* empty */ %prec EMPTY
  2350.         { $<ttype>$ = xref_tag (current_aggr, $<ttype>0, NULL_TREE, 0); }
  2351.     ;
  2352.  
  2353. named_class_head:
  2354.       named_class_head_sans_basetype %prec EMPTY
  2355.         { $$ = xref_tag (current_aggr, $1, NULL_TREE, 1); }
  2356.     | named_class_head_sans_basetype_defn do_xref_defn
  2357.           maybe_base_class_list %prec EMPTY
  2358.         { 
  2359.           $$ = $<ttype>2;
  2360.           if ($3)
  2361.                     xref_basetypes (current_aggr, $1, $<ttype>2, $3); 
  2362.         }
  2363.     | named_complex_class_head_sans_basetype maybe_base_class_list
  2364.         { 
  2365.           $$ = TREE_TYPE ($1);
  2366.           if ($2)
  2367.             xref_basetypes (current_aggr, $1, TREE_TYPE ($1), $2); 
  2368.         }
  2369.     ;
  2370.  
  2371. unnamed_class_head: aggr '{'
  2372.         { $$ = xref_tag ($$, make_anon_name (), NULL_TREE, 0);
  2373.           yyungetc ('{', 1); }
  2374.     ;
  2375.  
  2376. class_head: unnamed_class_head | named_class_head ;
  2377.  
  2378. maybe_base_class_list:
  2379.       %prec EMPTY /* empty */
  2380.         { $$ = NULL_TREE; }
  2381.     | ':' see_typename %prec EMPTY
  2382.         { yyungetc(':', 1); $$ = NULL_TREE; }
  2383.     | ':' see_typename base_class_list  %prec EMPTY
  2384.         { $$ = $3; }
  2385.     ;
  2386.  
  2387. base_class_list:
  2388.       base_class
  2389.     | base_class_list ',' see_typename base_class
  2390.         { $$ = chainon ($$, $4); }
  2391.     ;
  2392.  
  2393. base_class:
  2394.       base_class.1
  2395.         {
  2396.           tree type;
  2397.           type = IDENTIFIER_TYPE_VALUE ($$);
  2398.           if (! is_aggr_typedef ($$, 1))
  2399.             $$ = NULL_TREE;
  2400.           else if (current_aggr == signature_type_node
  2401.                && (! type) && (! IS_SIGNATURE (type)))
  2402.             {
  2403.               error ("class name not allowed as base signature");
  2404.               $$ = NULL_TREE;
  2405.             }
  2406.           else if (current_aggr == signature_type_node)
  2407.             {
  2408.               sorry ("signature inheritance, base type `%s' ignored",
  2409.                  IDENTIFIER_POINTER ($$));
  2410.               $$ = build_tree_list ((tree)access_public, $$);
  2411.             }
  2412.           else if (type && IS_SIGNATURE (type))
  2413.             {
  2414.               error ("signature name not allowed as base class");
  2415.               $$ = NULL_TREE;
  2416.             }
  2417.           else
  2418.             $$ = build_tree_list ((tree)access_default, $$);
  2419.         }
  2420.     | base_class_access_list see_typename base_class.1
  2421.         {
  2422.           tree type;
  2423.           type = IDENTIFIER_TYPE_VALUE ($3);
  2424.           if (current_aggr == signature_type_node)
  2425.             error ("access and source specifiers not allowed in signature");
  2426.           if (! is_aggr_typedef ($3, 1))
  2427.             $$ = NULL_TREE;
  2428.           else if (current_aggr == signature_type_node
  2429.                && (! type) && (! IS_SIGNATURE (type)))
  2430.             {
  2431.               error ("class name not allowed as base signature");
  2432.               $$ = NULL_TREE;
  2433.             }
  2434.           else if (current_aggr == signature_type_node)
  2435.             {
  2436.               sorry ("signature inheritance, base type `%s' ignored",
  2437.                  IDENTIFIER_POINTER ($$));
  2438.               $$ = build_tree_list ((tree)access_public, $3);
  2439.             }
  2440.           else if (type && IS_SIGNATURE (type))
  2441.             {
  2442.               error ("signature name not allowed as base class");
  2443.               $$ = NULL_TREE;
  2444.             }
  2445.           else
  2446.             $$ = build_tree_list ((tree) $$, $3);
  2447.         }
  2448.     ;
  2449.  
  2450. base_class.1:
  2451.       complete_type_name
  2452.     | SIGOF '(' expr ')'
  2453.         {
  2454.           if (current_aggr == signature_type_node)
  2455.             {
  2456.               if (IS_AGGR_TYPE (TREE_TYPE ($3)))
  2457.             {
  2458.               sorry ("`sigof' as base signature specifier");
  2459.               /* need to return some dummy signature identifier */
  2460.               $$ = $3;
  2461.             }
  2462.               else
  2463.             {
  2464.               error ("`sigof' applied to non-aggregate expression");
  2465.               $$ = error_mark_node;
  2466.             }
  2467.             }
  2468.           else
  2469.             {
  2470.               error ("`sigof' in struct or class declaration");
  2471.               $$ = error_mark_node;
  2472.             }
  2473.         }
  2474.     | SIGOF '(' type_id ')'
  2475.         {
  2476.           if (current_aggr == signature_type_node)
  2477.             {
  2478.               if (IS_AGGR_TYPE (groktypename ($3)))
  2479.             {
  2480.               sorry ("`sigof' as base signature specifier");
  2481.               /* need to return some dummy signature identifier */
  2482.               $$ = $3;
  2483.             }
  2484.               else
  2485.             {
  2486.               error ("`sigof' applied to non-aggregate expression");
  2487.               $$ = error_mark_node;
  2488.             }
  2489.             }
  2490.           else
  2491.             {
  2492.               error ("`sigof' in struct or class declaration");
  2493.               $$ = error_mark_node;
  2494.             }
  2495.         }
  2496.     ;
  2497.  
  2498. base_class_access_list:
  2499.       VISSPEC see_typename
  2500.     | SCSPEC see_typename
  2501.         { if ($<ttype>$ != ridpointers[(int)RID_VIRTUAL])
  2502.             sorry ("non-virtual access");
  2503.           $$ = access_default_virtual; }
  2504.     | base_class_access_list VISSPEC see_typename
  2505.         { int err = 0;
  2506.           if ($2 == access_protected)
  2507.             {
  2508.               warning ("`protected' access not implemented");
  2509.               $2 = access_public;
  2510.               err++;
  2511.             }
  2512.           else if ($2 == access_public)
  2513.             {
  2514.               if ($1 == access_private)
  2515.             {
  2516.             mixed:
  2517.               error ("base class cannot be public and private");
  2518.             }
  2519.               else if ($1 == access_default_virtual)
  2520.             $$ = access_public_virtual;
  2521.             }
  2522.           else /* $2 == access_private */
  2523.             {
  2524.               if ($1 == access_public)
  2525.             goto mixed;
  2526.               else if ($1 == access_default_virtual)
  2527.             $$ = access_private_virtual;
  2528.             }
  2529.         }
  2530.     | base_class_access_list SCSPEC see_typename
  2531.         { if ($2 != ridpointers[(int)RID_VIRTUAL])
  2532.             sorry ("non-virtual access");
  2533.           if ($$ == access_public)
  2534.             $$ = access_public_virtual;
  2535.           else if ($$ == access_private)
  2536.             $$ = access_private_virtual; }
  2537.     ;
  2538.  
  2539. left_curly: '{'
  2540.         { tree t = $<ttype>0;
  2541.           push_obstacks_nochange ();
  2542.           end_temporary_allocation ();
  2543.  
  2544.           if (! IS_AGGR_TYPE (t))
  2545.             {
  2546.               t = $<ttype>0 = make_lang_type (RECORD_TYPE);
  2547.               TYPE_NAME (t) = get_identifier ("erroneous type");
  2548.             }
  2549.           if (TYPE_SIZE (t))
  2550.             duplicate_tag_error (t);
  2551.                   if (TYPE_SIZE (t) || TYPE_BEING_DEFINED (t))
  2552.                     {
  2553.                       t = make_lang_type (TREE_CODE (t));
  2554.                       pushtag (TYPE_IDENTIFIER ($<ttype>0), t, 0);
  2555.                       $<ttype>0 = t;
  2556.                     }
  2557.           pushclass (t, 0);
  2558.           TYPE_BEING_DEFINED (t) = 1;
  2559.           /* Reset the interface data, at the earliest possible
  2560.              moment, as it might have been set via a class foo;
  2561.              before.  */
  2562.           /* Don't change signatures.  */
  2563.           if (! IS_SIGNATURE (t))
  2564.             {
  2565.               extern tree pending_vtables;
  2566.               int needs_writing;
  2567.               tree name = TYPE_IDENTIFIER (t);
  2568.  
  2569.               if (! ANON_AGGRNAME_P (name))
  2570.             {
  2571.               CLASSTYPE_INTERFACE_ONLY (t) = interface_only;
  2572.               SET_CLASSTYPE_INTERFACE_UNKNOWN_X
  2573.                 (t, interface_unknown);
  2574.             }
  2575.  
  2576.               /* Record how to set the access of this class's
  2577.              virtual functions.  If write_virtuals == 2 or 3, then
  2578.              inline virtuals are ``extern inline''.  */
  2579.               switch (write_virtuals)
  2580.             {
  2581.             case 0:
  2582.             case 1:
  2583.               needs_writing = 1;
  2584.               break;
  2585.             case 2:
  2586.               needs_writing = !! value_member (name, pending_vtables);
  2587.               break;
  2588.             case 3:
  2589.               needs_writing = ! CLASSTYPE_INTERFACE_ONLY (t)
  2590.                 && CLASSTYPE_INTERFACE_KNOWN (t);
  2591.               break;
  2592.             default:
  2593.               needs_writing = 0;
  2594.             }
  2595.               CLASSTYPE_VTABLE_NEEDS_WRITING (t) = needs_writing;
  2596.             }
  2597. #if 0
  2598.           t = TYPE_IDENTIFIER ($<ttype>0);
  2599.           if (t && IDENTIFIER_TEMPLATE (t))
  2600.             overload_template_name (t, 1);
  2601. #endif
  2602.         }
  2603.     ;
  2604.  
  2605. opt.component_decl_list:
  2606.     /* empty */
  2607.         { $$ = NULL_TREE; }
  2608.     | component_decl_list
  2609.         {
  2610.           if (current_aggr == signature_type_node)
  2611.             $$ = build_tree_list ((tree) access_public, $$);
  2612.           else
  2613.             $$ = build_tree_list ((tree) access_default, $$);
  2614.         }
  2615.     | opt.component_decl_list VISSPEC ':' component_decl_list
  2616.         {
  2617.           tree visspec = (tree) $2;
  2618.  
  2619.           if (current_aggr == signature_type_node)
  2620.             {
  2621.               error ("access specifier not allowed in signature");
  2622.               visspec = (tree) access_public;
  2623.             }
  2624.           $$ = chainon ($$, build_tree_list (visspec, $4));
  2625.         }
  2626.     | opt.component_decl_list VISSPEC ':'
  2627.         {
  2628.           if (current_aggr == signature_type_node)
  2629.             error ("access specifier not allowed in signature");
  2630.         }
  2631.     ;
  2632.  
  2633. /* Note: we no longer warn about the semicolon after a component_decl_list.
  2634.    ARM $9.2 says that the semicolon is optional, and therefore allowed.  */
  2635. component_decl_list:
  2636.       component_decl
  2637.         { if ($$ == void_type_node) $$ = NULL_TREE; 
  2638.         }
  2639.     | component_decl_list component_decl
  2640.         { /* In pushdecl, we created a reverse list of names
  2641.              in this binding level.  Make sure that the chain
  2642.              of what we're trying to add isn't the item itself
  2643.              (which can happen with what pushdecl's doing).  */
  2644.           if ($2 != NULL_TREE && $2 != void_type_node)
  2645.             {
  2646.               if (TREE_CHAIN ($2) != $$)
  2647.             $$ = chainon ($$, $2);
  2648.               else
  2649.             $$ = $2;
  2650.             }
  2651.         }
  2652.     ;
  2653.  
  2654. component_decl:
  2655.       component_decl_1 ';'
  2656.         { }
  2657.     | component_decl_1 '}'
  2658.         { error ("missing ';' before right brace");
  2659.           yyungetc ('}', 0); }
  2660.     /* C++: handle constructors, destructors and inline functions */
  2661.     /* note that INLINE is like a TYPESPEC */
  2662.     | fn.def2 ':' /* base_init compstmt */
  2663.         { $$ = finish_method ($$); }
  2664.     | fn.def2 TRY /* base_init compstmt */
  2665.         { $$ = finish_method ($$); }
  2666.     | fn.def2 RETURN /* base_init compstmt */
  2667.         { $$ = finish_method ($$); }
  2668.     | fn.def2 '{' /* nodecls compstmt */
  2669.         { $$ = finish_method ($$); }
  2670.     | ';'
  2671.         { $$ = NULL_TREE; }
  2672.     ;
  2673.  
  2674. component_decl_1:
  2675.     /* Do not add a "typed_declspecs declarator" rule here for
  2676.        speed; we need to call grok_x_components for enums, so the
  2677.        speedup would be insignificant.  */
  2678.       typed_declspecs components
  2679.         { $$ = grok_x_components ($1, $2); }
  2680.     | declmods notype_components
  2681.         { $$ = grok_x_components ($1, $2); }
  2682.     | notype_declarator exception_specification_opt maybeasm maybe_attribute maybe_init
  2683.         { $$ = grokfield ($$, NULL_TREE, $2, $5, $3,
  2684.                   build_tree_list ($4, NULL_TREE)); }
  2685.     | ':' expr_no_commas
  2686.         { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); }
  2687.     | error
  2688.         { $$ = NULL_TREE; }
  2689.  
  2690.     /* These rules introduce a reduce/reduce conflict; in
  2691.         typedef int foo, bar;
  2692.         class A {
  2693.           foo (bar);
  2694.         };
  2695.        should "A::foo" be declared as a function or "A::bar" as a data
  2696.        member? In other words, is "bar" an after_type_declarator or a
  2697.        parmlist? */
  2698.     | typed_declspecs '(' parmlist ')' type_quals exception_specification_opt maybeasm maybe_attribute maybe_init
  2699.         { tree specs, attrs;
  2700.           split_specs_attrs ($1, &specs, &attrs);
  2701.           $$ = build_parse_node (CALL_EXPR, TREE_VALUE (specs),
  2702.                      $3, $5);
  2703.           $$ = grokfield ($$, TREE_CHAIN (specs), $6, $9, $7,
  2704.                   build_tree_list ($8, attrs)); }
  2705.     | typed_declspecs LEFT_RIGHT type_quals exception_specification_opt maybeasm maybe_attribute maybe_init
  2706.         { tree specs, attrs;
  2707.           split_specs_attrs ($1, &specs, &attrs);
  2708.           $$ = build_parse_node (CALL_EXPR, TREE_VALUE (specs),
  2709.                      empty_parms (), $3);
  2710.           $$ = grokfield ($$, TREE_CHAIN (specs), $4, $7, $5,
  2711.                   build_tree_list ($6, attrs)); }
  2712.     | using_decl
  2713.         { $$ = do_class_using_decl ($1); }
  2714.     ;
  2715.  
  2716. /* The case of exactly one component is handled directly by component_decl. */
  2717. /* ??? Huh? ^^^ */
  2718. components:
  2719.       /* empty: possibly anonymous */
  2720.         { $$ = NULL_TREE; }
  2721.     | component_declarator0
  2722.     | components ',' component_declarator
  2723.         {
  2724.           /* In this context, void_type_node encodes
  2725.              friends.  They have been recorded elsewhere.  */
  2726.           if ($$ == void_type_node)
  2727.             $$ = $3;
  2728.           else
  2729.             $$ = chainon ($$, $3);
  2730.         }
  2731.     ;
  2732.  
  2733. notype_components:
  2734.       /* empty: possibly anonymous */
  2735.         { $$ = NULL_TREE; }
  2736.     | notype_component_declarator0
  2737.     | notype_components ',' notype_component_declarator
  2738.         {
  2739.           /* In this context, void_type_node encodes
  2740.              friends.  They have been recorded elsewhere.  */
  2741.           if ($$ == void_type_node)
  2742.             $$ = $3;
  2743.           else
  2744.             $$ = chainon ($$, $3);
  2745.         }
  2746.     ;
  2747.  
  2748. component_declarator0:
  2749.       after_type_component_declarator0
  2750.     | notype_component_declarator0
  2751.     ;
  2752.  
  2753. component_declarator:
  2754.       after_type_component_declarator
  2755.     | notype_component_declarator
  2756.     ;
  2757.  
  2758. after_type_component_declarator0:
  2759.       after_type_declarator exception_specification_opt maybeasm maybe_attribute maybe_init
  2760.         { split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2761.                      &prefix_attributes);
  2762.           $<ttype>0 = current_declspecs;
  2763.           $$ = grokfield ($$, current_declspecs, $2, $5, $3,
  2764.                   build_tree_list ($4, prefix_attributes)); }
  2765.     | TYPENAME ':' expr_no_commas maybe_attribute
  2766.         { split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2767.                      &prefix_attributes);
  2768.           $<ttype>0 = current_declspecs;
  2769.           $$ = grokbitfield ($$, current_declspecs, $3);
  2770.           cplus_decl_attributes ($$, $4, prefix_attributes); }
  2771.     ;
  2772.  
  2773. notype_component_declarator0:
  2774.       notype_declarator exception_specification_opt maybeasm maybe_attribute maybe_init
  2775.         { split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2776.                      &prefix_attributes);
  2777.           $<ttype>0 = current_declspecs;
  2778.           $$ = grokfield ($$, current_declspecs, $2, $5, $3,
  2779.                   build_tree_list ($4, prefix_attributes)); }
  2780.     | IDENTIFIER ':' expr_no_commas maybe_attribute
  2781.         { split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2782.                      &prefix_attributes);
  2783.           $<ttype>0 = current_declspecs;
  2784.           $$ = grokbitfield ($$, current_declspecs, $3);
  2785.           cplus_decl_attributes ($$, $4, prefix_attributes); }
  2786.     | ':' expr_no_commas maybe_attribute
  2787.         { split_specs_attrs ($<ttype>0, ¤t_declspecs,
  2788.                      &prefix_attributes);
  2789.           $<ttype>0 = current_declspecs;
  2790.           $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
  2791.           cplus_decl_attributes ($$, $3, prefix_attributes); }
  2792.     ;
  2793.  
  2794. after_type_component_declarator:
  2795.       after_type_declarator exception_specification_opt maybeasm maybe_attribute maybe_init
  2796.         { $$ = grokfield ($$, current_declspecs, $2, $5, $3,
  2797.                   build_tree_list ($4, prefix_attributes)); }
  2798.     | TYPENAME ':' expr_no_commas maybe_attribute
  2799.         { $$ = grokbitfield ($$, current_declspecs, $3);
  2800.           cplus_decl_attributes ($$, $4, prefix_attributes); }
  2801.     ;
  2802.  
  2803. notype_component_declarator:
  2804.       notype_declarator exception_specification_opt maybeasm maybe_attribute maybe_init
  2805.         { $$ = grokfield ($$, current_declspecs, $2, $5, $3,
  2806.                   build_tree_list ($4, prefix_attributes)); }
  2807.     | IDENTIFIER ':' expr_no_commas maybe_attribute
  2808.         { $$ = grokbitfield ($$, current_declspecs, $3);
  2809.           cplus_decl_attributes ($$, $4, prefix_attributes); }
  2810.     | ':' expr_no_commas maybe_attribute
  2811.         { $$ = grokbitfield (NULL_TREE, current_declspecs, $2);
  2812.           cplus_decl_attributes ($$, $3, prefix_attributes); }
  2813.     ;
  2814.  
  2815. /* We chain the enumerators in reverse order.
  2816.    Because of the way enums are built, the order is
  2817.    insignificant.  Take advantage of this fact.  */
  2818.  
  2819. enumlist:
  2820.       enumerator
  2821.     | enumlist ',' enumerator
  2822.         { TREE_CHAIN ($3) = $$; $$ = $3; }
  2823.     ;
  2824.  
  2825. enumerator:
  2826.       identifier
  2827.         { $$ = build_enumerator ($$, NULL_TREE); }
  2828.     | identifier '=' expr_no_commas
  2829.         { $$ = build_enumerator ($$, $3); }
  2830.     ;
  2831.  
  2832. /* ANSI new-type-id (5.3.4) */
  2833. new_type_id:
  2834.       type_specifier_seq new_declarator
  2835.         { $$ = build_decl_list ($$, $2); }
  2836.     | type_specifier_seq %prec EMPTY
  2837.         { $$ = build_decl_list ($$, NULL_TREE); }
  2838.     /* GNU extension to allow arrays of arbitrary types with
  2839.        non-constant dimension.  */
  2840.     | '(' type_id ')' '[' expr ']'
  2841.         {
  2842.           if (pedantic)
  2843.             pedwarn ("ANSI C++ forbids array dimensions with parenthesized type in new");
  2844.           $$ = build_parse_node (ARRAY_REF, TREE_VALUE ($2), $5);
  2845.           $$ = build_decl_list (TREE_PURPOSE ($2), $$);
  2846.         }
  2847.     ;
  2848.  
  2849. type_quals:
  2850.       /* empty */ %prec EMPTY
  2851.         { $$ = NULL_TREE; }
  2852.     | type_quals TYPE_QUAL
  2853.         { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
  2854.     ;
  2855.  
  2856. nonempty_type_quals:
  2857.       TYPE_QUAL
  2858.         { $$ = IDENTIFIER_AS_LIST ($$); }
  2859.     | nonempty_type_quals TYPE_QUAL
  2860.         { $$ = decl_tree_cons (NULL_TREE, $2, $$); }
  2861.     ;
  2862.  
  2863. /* These rules must follow the rules for function declarations
  2864.    and component declarations.  That way, longer rules are preferred.  */
  2865.  
  2866. suspend_mom:
  2867.     { $<itype>$ = suspend_momentary (); } 
  2868.  
  2869. /* An expression which will not live on the momentary obstack.  */
  2870. nonmomentary_expr:
  2871.     suspend_mom expr
  2872.     { resume_momentary ((int) $<itype>1); $$ = $2; }
  2873.     ;
  2874.  
  2875. /* An expression which will not live on the momentary obstack.  */
  2876. maybe_parmlist:
  2877.       suspend_mom '(' nonnull_exprlist ')'
  2878.         { resume_momentary ((int) $<itype>1); $$ = $3; }
  2879.     | suspend_mom '(' parmlist ')'
  2880.         { resume_momentary ((int) $<itype>1); $$ = $3; }
  2881.     | suspend_mom LEFT_RIGHT
  2882.         { resume_momentary ((int) $<itype>1); $$ = empty_parms (); }
  2883.     | suspend_mom '(' error ')'
  2884.         { resume_momentary ((int) $<itype>1); $$ = NULL_TREE; }
  2885.     ;
  2886.  
  2887. /* A declarator that is allowed only after an explicit typespec.  */
  2888. /* may all be followed by prec '.' */
  2889. after_type_declarator:
  2890.       '*' nonempty_type_quals after_type_declarator  %prec UNARY
  2891.         { $$ = make_pointer_declarator ($2, $3); }
  2892.     | '&' nonempty_type_quals after_type_declarator  %prec UNARY
  2893.         { $$ = make_reference_declarator ($2, $3); }
  2894.     | '*' after_type_declarator  %prec UNARY
  2895.         { $$ = make_pointer_declarator (NULL_TREE, $2); }
  2896.     | '&' after_type_declarator  %prec UNARY
  2897.         { $$ = make_reference_declarator (NULL_TREE, $2); }
  2898.     | ptr_to_mem type_quals after_type_declarator
  2899.         { tree arg = make_pointer_declarator ($2, $3);
  2900.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  2901.         }
  2902.     | direct_after_type_declarator
  2903.     ;
  2904.  
  2905. qualified_type_name:
  2906.       type_name %prec EMPTY
  2907.         {
  2908.           /* Remember that this name has been used in the class
  2909.              definition, as per [class.scope0] */
  2910.           if (current_class_type
  2911.               && TYPE_BEING_DEFINED (current_class_type)
  2912.               && ! IDENTIFIER_CLASS_VALUE ($$))
  2913.             {
  2914.               tree t = lookup_name ($$, -2);
  2915.               if (t)
  2916.             pushdecl_class_level (t);
  2917.             }
  2918.         }
  2919.     | nested_type
  2920.     ;
  2921.  
  2922. nested_type:
  2923.     nested_name_specifier type_name %prec EMPTY
  2924.         { $$ = $2; }
  2925.     ;
  2926.  
  2927. direct_after_type_declarator:
  2928.       direct_after_type_declarator maybe_parmlist type_quals %prec '.'
  2929.         { $$ = build_parse_node (CALL_EXPR, $$, $2, $3); }
  2930.     | direct_after_type_declarator '[' nonmomentary_expr ']'
  2931.         { $$ = build_parse_node (ARRAY_REF, $$, $3); }
  2932.     | direct_after_type_declarator '[' ']'
  2933.         { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
  2934.     | '(' after_type_declarator ')'
  2935.         { $$ = $2; }
  2936.     | nested_name_specifier type_name %prec EMPTY
  2937.         { push_nested_class (TREE_TYPE ($$), 3);
  2938.           $$ = build_parse_node (SCOPE_REF, $$, $2);
  2939.           TREE_COMPLEXITY ($$) = current_class_depth; }
  2940.     | type_name %prec EMPTY
  2941.     ;
  2942.  
  2943. /* A declarator allowed whether or not there has been
  2944.    an explicit typespec.  These cannot redeclare a typedef-name.  */
  2945.  
  2946. notype_declarator:
  2947.       '*' nonempty_type_quals notype_declarator  %prec UNARY
  2948.         { $$ = make_pointer_declarator ($2, $3); }
  2949.     | '&' nonempty_type_quals notype_declarator  %prec UNARY
  2950.         { $$ = make_reference_declarator ($2, $3); }
  2951.     | '*' notype_declarator  %prec UNARY
  2952.         { $$ = make_pointer_declarator (NULL_TREE, $2); }
  2953.     | '&' notype_declarator  %prec UNARY
  2954.         { $$ = make_reference_declarator (NULL_TREE, $2); }
  2955.     | ptr_to_mem type_quals notype_declarator
  2956.         { tree arg = make_pointer_declarator ($2, $3);
  2957.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  2958.         }
  2959.     | direct_notype_declarator
  2960.     ;
  2961.  
  2962. complex_notype_declarator:
  2963.       '*' nonempty_type_quals notype_declarator  %prec UNARY
  2964.         { $$ = make_pointer_declarator ($2, $3); }
  2965.     | '&' nonempty_type_quals notype_declarator  %prec UNARY
  2966.         { $$ = make_reference_declarator ($2, $3); }
  2967.     | '*' complex_notype_declarator  %prec UNARY
  2968.         { $$ = make_pointer_declarator (NULL_TREE, $2); }
  2969.     | '&' complex_notype_declarator  %prec UNARY
  2970.         { $$ = make_reference_declarator (NULL_TREE, $2); }
  2971.     | ptr_to_mem type_quals notype_declarator
  2972.         { tree arg = make_pointer_declarator ($2, $3);
  2973.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  2974.         }
  2975.     | complex_direct_notype_declarator
  2976.     ;
  2977.  
  2978. complex_direct_notype_declarator:
  2979.       direct_notype_declarator maybe_parmlist type_quals  %prec '.'
  2980.         { $$ = build_parse_node (CALL_EXPR, $$, $2, $3); }
  2981.     | '(' complex_notype_declarator ')'
  2982.         { $$ = $2; }
  2983.     | direct_notype_declarator '[' nonmomentary_expr ']'
  2984.         { $$ = build_parse_node (ARRAY_REF, $$, $3); }
  2985.     | direct_notype_declarator '[' ']'
  2986.         { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
  2987.     | notype_qualified_id
  2988.         { if (TREE_TYPE (OP0 ($$)) != current_class_type)
  2989.             {
  2990.               push_nested_class (TREE_TYPE (OP0 ($$)), 3);
  2991.               TREE_COMPLEXITY ($$) = current_class_depth;
  2992.             }
  2993.         }
  2994.     ;
  2995.  
  2996. qualified_id:
  2997.     nested_name_specifier unqualified_id
  2998.         { got_scope = NULL_TREE;
  2999.           $$ = build_parse_node (SCOPE_REF, $$, $2); }
  3000.     ;
  3001.  
  3002. notype_qualified_id:
  3003.     nested_name_specifier notype_unqualified_id
  3004.         { got_scope = NULL_TREE;
  3005.           $$ = build_parse_node (SCOPE_REF, $$, $2); }
  3006.     ;
  3007.  
  3008. overqualified_id:
  3009.       notype_qualified_id
  3010.     | global_scope notype_qualified_id
  3011.         { $$ = $2; }
  3012.     ;
  3013.  
  3014. functional_cast:
  3015.       typespec '(' nonnull_exprlist ')'
  3016.         { $$ = build_functional_cast ($$, $3); }
  3017.     | typespec '(' expr_or_declarator ')'
  3018.         { $$ = reparse_decl_as_expr ($$, $3); }
  3019.     | typespec fcast_or_absdcl %prec EMPTY
  3020.         { $$ = reparse_absdcl_as_expr ($$, $2); }
  3021.     ;
  3022.  
  3023. type_name:
  3024.       TYPENAME
  3025.     | template_type %prec EMPTY
  3026.     ;
  3027.  
  3028. nested_name_specifier:
  3029.       nested_name_specifier_1
  3030.     | nested_name_specifier nested_name_specifier_1
  3031.         { $$ = $2; }
  3032.     ;
  3033.  
  3034. /* Why the @#$%^& do type_name and notype_identifier need to be expanded
  3035.    inline here?!?  (jason) */
  3036. nested_name_specifier_1:
  3037.       TYPENAME SCOPE
  3038.         { got_scope = TREE_TYPE ($$); }
  3039.     | NSNAME SCOPE
  3040.         { got_scope = $$; }
  3041.     | template_type SCOPE
  3042.         { got_scope = TREE_TYPE ($$); }
  3043. /*     These break 'const i;'
  3044.     | IDENTIFIER SCOPE
  3045.         {
  3046.          failed_scope:
  3047.           cp_error ("`%D' is not an aggregate typedef", 
  3048.                 lastiddecl ? lastiddecl : $$);
  3049.           $$ = error_mark_node;
  3050.         }
  3051.     | PTYPENAME SCOPE
  3052.         { goto failed_scope; } */
  3053.     ;
  3054.  
  3055. complete_type_name:
  3056.       qualified_type_name
  3057.     | global_scope qualified_type_name
  3058.         { $$ = $2; }
  3059.     ;
  3060.  
  3061. complex_type_name:
  3062.       nested_type
  3063.     | global_scope qualified_type_name
  3064.         { $$ = $2; }
  3065.     ;
  3066.  
  3067. ptr_to_mem:
  3068.       nested_name_specifier '*'
  3069.         { got_scope = NULL_TREE; }
  3070.     | global_scope nested_name_specifier '*'
  3071.         { $$ = $2; got_scope = NULL_TREE; }
  3072.     ;
  3073.  
  3074. /* All uses of explicit global scope must go through this nonterminal so
  3075.    that got_scope will be set before yylex is called to get the next token. */
  3076. global_scope:
  3077.       SCOPE
  3078.         { got_scope = void_type_node; }
  3079.     ;
  3080.  
  3081. /* ANSI new-declarator (5.3.4) */
  3082. new_declarator:
  3083.       '*' type_quals new_declarator
  3084.         { $$ = make_pointer_declarator ($2, $3); }
  3085.     | '*' type_quals  %prec EMPTY
  3086.         { $$ = make_pointer_declarator ($2, NULL_TREE); }
  3087.     | '&' type_quals new_declarator %prec EMPTY
  3088.         { $$ = make_reference_declarator ($2, $3); }
  3089.     | '&' type_quals %prec EMPTY
  3090.         { $$ = make_reference_declarator ($2, NULL_TREE); }
  3091.     | ptr_to_mem type_quals %prec EMPTY
  3092.         { tree arg = make_pointer_declarator ($2, NULL_TREE);
  3093.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  3094.         }
  3095.     | ptr_to_mem type_quals new_declarator
  3096.         { tree arg = make_pointer_declarator ($2, $3);
  3097.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  3098.         }
  3099.     | direct_new_declarator %prec EMPTY
  3100.     ;
  3101.  
  3102. /* ANSI direct-new-declarator (5.3.4) */
  3103. direct_new_declarator:
  3104.       '[' expr ']'
  3105.         { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
  3106.     | direct_new_declarator '[' nonmomentary_expr ']'
  3107.         { $$ = build_parse_node (ARRAY_REF, $$, $3); }
  3108.     ;
  3109.  
  3110. /* ANSI abstract-declarator (8.1) */
  3111. absdcl:
  3112.       '*' nonempty_type_quals absdcl
  3113.         { $$ = make_pointer_declarator ($2, $3); }
  3114.     | '*' absdcl
  3115.         { $$ = make_pointer_declarator (NULL_TREE, $2); }
  3116.     | '*' nonempty_type_quals  %prec EMPTY
  3117.         { $$ = make_pointer_declarator ($2, NULL_TREE); }
  3118.     | '*' %prec EMPTY
  3119.         { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); }
  3120.     | '&' nonempty_type_quals absdcl
  3121.         { $$ = make_reference_declarator ($2, $3); }
  3122.     | '&' absdcl
  3123.         { $$ = make_reference_declarator (NULL_TREE, $2); }
  3124.     | '&' nonempty_type_quals %prec EMPTY
  3125.         { $$ = make_reference_declarator ($2, NULL_TREE); }
  3126.     | '&' %prec EMPTY
  3127.         { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); }
  3128.     | ptr_to_mem type_quals %prec EMPTY
  3129.         { tree arg = make_pointer_declarator ($2, NULL_TREE);
  3130.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  3131.         }
  3132.     | ptr_to_mem type_quals absdcl
  3133.         { tree arg = make_pointer_declarator ($2, $3);
  3134.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  3135.         }
  3136.     | direct_abstract_declarator %prec EMPTY
  3137.     ;
  3138.  
  3139. /* ANSI direct-abstract-declarator (8.1) */
  3140. direct_abstract_declarator:
  3141.       '(' absdcl ')'
  3142.         { $$ = $2; }
  3143.       /* `(typedef)1' is `int'.  */
  3144.     | PAREN_STAR_PAREN
  3145.     | direct_abstract_declarator '(' parmlist ')' type_quals  %prec '.'
  3146.         { $$ = build_parse_node (CALL_EXPR, $$, $3, $5); }
  3147.     | direct_abstract_declarator LEFT_RIGHT type_quals  %prec '.'
  3148.         { $$ = build_parse_node (CALL_EXPR, $$, empty_parms (), $3); }
  3149.     | direct_abstract_declarator '[' nonmomentary_expr ']'  %prec '.'
  3150.         { $$ = build_parse_node (ARRAY_REF, $$, $3); }
  3151.     | direct_abstract_declarator '[' ']'  %prec '.'
  3152.         { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); }
  3153.     | '(' complex_parmlist ')' type_quals  %prec '.'
  3154.         { $$ = build_parse_node (CALL_EXPR, NULL_TREE, $2, $4); }
  3155.     | regcast_or_absdcl type_quals %prec '.'
  3156.         { TREE_OPERAND ($$, 2) = $2; }
  3157.     | fcast_or_absdcl type_quals %prec '.'
  3158.         { TREE_OPERAND ($$, 2) = $2; }
  3159.     | '[' nonmomentary_expr ']'  %prec '.'
  3160.         { $$ = build_parse_node (ARRAY_REF, NULL_TREE, $2); }
  3161.     | '[' ']'  %prec '.'
  3162.         { $$ = build_parse_node (ARRAY_REF, NULL_TREE, NULL_TREE); }
  3163.     ;
  3164.  
  3165. /* For C++, decls and stmts can be intermixed, so we don't need to
  3166.    have a special rule that won't start parsing the stmt section
  3167.    until we have a stmt that parses without errors.  */
  3168.  
  3169. stmts:
  3170.       stmt
  3171.     | errstmt
  3172.     | stmts stmt
  3173.     | stmts errstmt
  3174.     ;
  3175.  
  3176. errstmt:  error ';'
  3177.     ;
  3178.  
  3179. /* build the LET_STMT node before parsing its contents,
  3180.   so that any LET_STMTs within the context can have their display pointers
  3181.   set up to point at this one.  */
  3182.  
  3183. .pushlevel:  /* empty */
  3184.         { emit_line_note (input_filename, lineno);
  3185.           pushlevel (0);
  3186.           clear_last_expr ();
  3187.           push_momentary ();
  3188.           expand_start_bindings (0); }
  3189.     ;
  3190.  
  3191. .poplevel:   /* empty */
  3192.         { expand_end_bindings (getdecls (), kept_level_p (), 1);
  3193.           $$ = poplevel (kept_level_p (), 1, 0);
  3194.           pop_momentary (); }
  3195.     ;
  3196.  
  3197. /* Read zero or more forward-declarations for labels
  3198.    that nested functions can jump to.  */
  3199. maybe_label_decls:
  3200.       /* empty */
  3201.     | label_decls
  3202.         { if (pedantic)
  3203.             pedwarn ("ANSI C++ forbids label declarations"); }
  3204.     ;
  3205.  
  3206. label_decls:
  3207.       label_decl
  3208.     | label_decls label_decl
  3209.     ;
  3210.  
  3211. label_decl:
  3212.       LABEL identifiers_or_typenames ';'
  3213.         { tree link;
  3214.           for (link = $2; link; link = TREE_CHAIN (link))
  3215.             {
  3216.               tree label = shadow_label (TREE_VALUE (link));
  3217.               C_DECLARED_LABEL_FLAG (label) = 1;
  3218.               declare_nonlocal_label (label);
  3219.             }
  3220.         }
  3221.     ;
  3222.  
  3223. /* This is the body of a function definition.
  3224.    It causes syntax errors to ignore to the next openbrace.  */
  3225. compstmt_or_error:
  3226.       compstmt
  3227.         {}
  3228.     | error compstmt
  3229.     ;
  3230.  
  3231. compstmt: '{' .pushlevel compstmtend .poplevel
  3232.         { $$ = $4; }
  3233.     ;
  3234.  
  3235. simple_if:
  3236.       IF
  3237.         { cond_stmt_keyword = "if"; }
  3238.       .pushlevel paren_cond_or_null
  3239.         { emit_line_note (input_filename, lineno);
  3240.           expand_start_cond ($4, 0); }
  3241.       implicitly_scoped_stmt
  3242.     ;
  3243.  
  3244. implicitly_scoped_stmt:
  3245.       compstmt
  3246.         { finish_stmt (); }
  3247.     | .pushlevel simple_stmt .poplevel
  3248.         { $$ = $3; }
  3249.     ;
  3250.  
  3251. stmt:
  3252.       compstmt
  3253.         { finish_stmt (); }
  3254.     | simple_stmt
  3255.     ;
  3256.  
  3257. simple_stmt:
  3258.       decl
  3259.         { finish_stmt (); }
  3260.     | expr ';'
  3261.         {
  3262.           tree expr = $1;
  3263.           emit_line_note (input_filename, lineno);
  3264.           /* Do default conversion if safe and possibly important,
  3265.              in case within ({...}).  */
  3266.           if ((TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
  3267.                && lvalue_p (expr))
  3268.               || TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE)
  3269.             expr = default_conversion (expr);
  3270.           cplus_expand_expr_stmt (expr);
  3271.           clear_momentary ();
  3272.           finish_stmt (); }
  3273.     | simple_if ELSE
  3274.         { expand_start_else (); }
  3275.       implicitly_scoped_stmt
  3276.         { expand_end_cond (); }
  3277.       .poplevel
  3278.         { finish_stmt (); }
  3279.     | simple_if %prec IF
  3280.         { expand_end_cond ();
  3281.           expand_end_bindings (getdecls (), kept_level_p (), 1);
  3282.           poplevel (kept_level_p (), 1, 0);
  3283.           pop_momentary ();
  3284.           finish_stmt (); }
  3285.     | WHILE
  3286.         { emit_nop ();
  3287.           emit_line_note (input_filename, lineno);
  3288.           expand_start_loop (1);
  3289.           cond_stmt_keyword = "while"; }
  3290.       .pushlevel paren_cond_or_null
  3291.         { expand_exit_loop_if_false (0, $4); }
  3292.       already_scoped_stmt .poplevel
  3293.         { expand_end_loop ();
  3294.           finish_stmt (); }
  3295.     | DO
  3296.         { emit_nop ();
  3297.           emit_line_note (input_filename, lineno);
  3298.           expand_start_loop_continue_elsewhere (1); }
  3299.       implicitly_scoped_stmt WHILE
  3300.         { expand_loop_continue_here ();
  3301.           cond_stmt_keyword = "do"; }
  3302.       paren_expr_or_null ';'
  3303.         { emit_line_note (input_filename, lineno);
  3304.           expand_exit_loop_if_false (0, $6);
  3305.           expand_end_loop ();
  3306.           clear_momentary ();
  3307.           finish_stmt (); }
  3308.     | FOR
  3309.         { emit_line_note (input_filename, lineno);
  3310.           if (flag_new_for_scope > 0)
  3311.             {
  3312.               /* Conditionalize .pushlevel */
  3313.               pushlevel (0);
  3314.               note_level_for_for ();
  3315.               clear_last_expr ();
  3316.               push_momentary ();
  3317.               expand_start_bindings (0);
  3318.             }
  3319.         }
  3320.       '(' for.init.statement
  3321.         { emit_nop ();
  3322.           emit_line_note (input_filename, lineno);
  3323.           expand_start_loop_continue_elsewhere (1); }
  3324.       .pushlevel xcond ';'
  3325.         { emit_line_note (input_filename, lineno);
  3326.           if ($7) expand_exit_loop_if_false (0, $7); }
  3327.       xexpr ')'
  3328.         /* Don't let the tree nodes for $10 be discarded
  3329.            by clear_momentary during the parsing of the next stmt.  */
  3330.         { push_momentary (); }
  3331.       already_scoped_stmt .poplevel
  3332.         { emit_line_note (input_filename, lineno);
  3333.           expand_loop_continue_here ();
  3334.           if ($10) cplus_expand_expr_stmt ($10);
  3335.           pop_momentary ();
  3336.           expand_end_loop ();
  3337.           if (flag_new_for_scope > 0)
  3338.             {
  3339.               expand_end_bindings (getdecls (), kept_level_p (), 1);
  3340.               poplevel (kept_level_p (), 1, 0);
  3341.               pop_momentary ();
  3342.             }
  3343.           finish_stmt (); }
  3344.     | SWITCH .pushlevel '(' condition ')'
  3345.         { emit_line_note (input_filename, lineno);
  3346.           c_expand_start_case ($4);
  3347.           push_switch ();
  3348.           /* Don't let the tree nodes for $4 be discarded by
  3349.              clear_momentary during the parsing of the next stmt.  */
  3350.           push_momentary (); }
  3351.       implicitly_scoped_stmt
  3352.         { expand_end_case ($4);
  3353.           pop_momentary ();
  3354.           pop_switch (); }
  3355.       .poplevel
  3356.         { finish_stmt (); }
  3357.     | CASE expr_no_commas ':'
  3358.         { register tree value = check_cp_case_value ($2);
  3359.           register tree label
  3360.             = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
  3361.  
  3362.           if (value != error_mark_node)
  3363.             {
  3364.               tree duplicate;
  3365.               int success = pushcase (value, convert_and_check,
  3366.                           label, &duplicate);
  3367.               if (success == 1)
  3368.             cp_error ("case label `%E' not within a switch statement", $2);
  3369.               else if (success == 2)
  3370.             {
  3371.               cp_error ("duplicate case value `%E'", $2);
  3372.               cp_error_at ("previously used here", duplicate);
  3373.             }
  3374.               else if (success == 3)
  3375.             warning ("case value out of range");
  3376.               else if (success == 5)
  3377.             cp_error ("case label `%E' within scope of cleanup or variable array", $2);
  3378.             }
  3379.           define_case_label (label);
  3380.         }
  3381.       stmt
  3382.     | CASE expr_no_commas ELLIPSIS expr_no_commas ':'
  3383.         { register tree value1 = check_cp_case_value ($2);
  3384.           register tree value2 = check_cp_case_value ($4);
  3385.           register tree label
  3386.             = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
  3387.  
  3388.           if (pedantic)
  3389.             pedwarn ("ANSI C++ forbids range expressions in switch statement");
  3390.           if (value1 != error_mark_node
  3391.               && value2 != error_mark_node)
  3392.             {
  3393.               tree duplicate;
  3394.               int success = pushcase_range (value1, value2,
  3395.                             convert_and_check, label,
  3396.                             &duplicate);
  3397.               if (success == 1)
  3398.             error ("case label not within a switch statement");
  3399.               else if (success == 2)
  3400.             {
  3401.               error ("duplicate (or overlapping) case value");
  3402.               error_with_decl (duplicate, "this is the first entry overlapping that value");
  3403.             }
  3404.               else if (success == 3)
  3405.             warning ("case value out of range");
  3406.               else if (success == 4)
  3407.             warning ("empty range specified");
  3408.               else if (success == 5)
  3409.             error ("case label within scope of cleanup or variable array");
  3410.             }
  3411.           define_case_label (label);
  3412.         }
  3413.       stmt
  3414.     | DEFAULT ':'
  3415.         {
  3416.           tree duplicate;
  3417.           register tree label
  3418.             = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
  3419.           int success = pushcase (NULL_TREE, 0, label, &duplicate);
  3420.           if (success == 1)
  3421.             error ("default label not within a switch statement");
  3422.           else if (success == 2)
  3423.             {
  3424.               error ("multiple default labels in one switch");
  3425.               error_with_decl (duplicate, "this is the first default label");
  3426.             }
  3427.           define_case_label (NULL_TREE);
  3428.         }
  3429.       stmt
  3430.     | BREAK ';'
  3431.         { emit_line_note (input_filename, lineno);
  3432.           if ( ! expand_exit_something ())
  3433.             error ("break statement not within loop or switch"); }
  3434.     | CONTINUE ';'
  3435.         { emit_line_note (input_filename, lineno);
  3436.           if (! expand_continue_loop (0))
  3437.             error ("continue statement not within a loop"); }
  3438.     | RETURN ';'
  3439.         { emit_line_note (input_filename, lineno);
  3440.           c_expand_return (NULL_TREE); }
  3441.     | RETURN expr ';'
  3442.         { emit_line_note (input_filename, lineno);
  3443.           c_expand_return ($2);
  3444.           finish_stmt ();
  3445.         }
  3446.     | asm_keyword maybe_type_qual '(' string ')' ';'
  3447.         { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
  3448.           emit_line_note (input_filename, lineno);
  3449.           expand_asm ($4);
  3450.           finish_stmt ();
  3451.         }
  3452.     /* This is the case with just output operands.  */
  3453.     | asm_keyword maybe_type_qual '(' string ':' asm_operands ')' ';'
  3454.         { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
  3455.           emit_line_note (input_filename, lineno);
  3456.           c_expand_asm_operands ($4, $6, NULL_TREE, NULL_TREE,
  3457.                      $2 == ridpointers[(int)RID_VOLATILE],
  3458.                      input_filename, lineno);
  3459.           finish_stmt ();
  3460.         }
  3461.     /* This is the case with input operands as well.  */
  3462.     | asm_keyword maybe_type_qual '(' string ':' asm_operands ':' asm_operands ')' ';'
  3463.         { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
  3464.           emit_line_note (input_filename, lineno);
  3465.           c_expand_asm_operands ($4, $6, $8, NULL_TREE,
  3466.                      $2 == ridpointers[(int)RID_VOLATILE],
  3467.                      input_filename, lineno);
  3468.           finish_stmt ();
  3469.         }
  3470.     /* This is the case with clobbered registers as well.  */
  3471.     | asm_keyword maybe_type_qual '(' string ':' asm_operands ':'
  3472.       asm_operands ':' asm_clobbers ')' ';'
  3473.         { if (TREE_CHAIN ($4)) $4 = combine_strings ($4);
  3474.           emit_line_note (input_filename, lineno);
  3475.           c_expand_asm_operands ($4, $6, $8, $10,
  3476.                      $2 == ridpointers[(int)RID_VOLATILE],
  3477.                      input_filename, lineno);
  3478.           finish_stmt ();
  3479.         }
  3480.     | GOTO '*' expr ';'
  3481.         { emit_line_note (input_filename, lineno);
  3482.           expand_computed_goto ($3); }
  3483.     | GOTO identifier ';'
  3484.         { tree decl;
  3485.           emit_line_note (input_filename, lineno);
  3486.           decl = lookup_label ($2);
  3487.           TREE_USED (decl) = 1;
  3488.           expand_goto (decl); }
  3489.     | label_colon stmt
  3490.         { finish_stmt (); }
  3491.     | label_colon '}'
  3492.         { error ("label must be followed by statement");
  3493.           yyungetc ('}', 0);
  3494.           finish_stmt (); }
  3495.     | ';'
  3496.         { finish_stmt (); }
  3497.     | try_block
  3498.     ;
  3499.  
  3500. function_try_block:
  3501.       TRY
  3502.         {
  3503.           if (! current_function_parms_stored)
  3504.             store_parm_decls ();
  3505.           expand_start_early_try_stmts ();
  3506.         }
  3507.       ctor_initializer_opt compstmt_or_error
  3508.         { expand_end_try_stmts ();
  3509.           expand_start_all_catch (); }
  3510.       handler_seq
  3511.         {
  3512.           expand_end_all_catch ();
  3513.           finish_function (lineno, (int)$3, 0);
  3514.         }
  3515.     ;
  3516.  
  3517. try_block:
  3518.       TRY
  3519.         { expand_start_try_stmts (); }
  3520.       compstmt
  3521.         { expand_end_try_stmts ();
  3522.           expand_start_all_catch (); }
  3523.       handler_seq
  3524.         { expand_end_all_catch (); }
  3525.     ;
  3526.  
  3527. handler_seq:
  3528.       /* empty */
  3529.     | handler_seq CATCH .pushlevel
  3530.         { dont_allow_type_definitions = "inside exception declarations"; }
  3531.       handler_args
  3532.         { dont_allow_type_definitions = 0; }
  3533.       compstmt
  3534.         { expand_end_catch_block (); }
  3535.       .poplevel
  3536.     ;
  3537.  
  3538. type_specifier_seq:
  3539.       typed_typespecs %prec EMPTY
  3540.     | nonempty_type_quals %prec EMPTY
  3541.     ;
  3542.  
  3543. handler_args:
  3544.       '(' ELLIPSIS ')'
  3545.         { expand_start_catch_block (NULL_TREE, NULL_TREE); }
  3546.     /* This doesn't allow reference parameters, the below does.
  3547.     | '(' type_specifier_seq absdcl ')'
  3548.         { expand_start_catch_block ($2, $3); }
  3549.     | '(' type_specifier_seq ')'
  3550.         { expand_start_catch_block ($2, NULL_TREE); }
  3551.     | '(' type_specifier_seq notype_declarator ')'
  3552.         { expand_start_catch_block ($2, $3); }
  3553.     | '(' typed_typespecs after_type_declarator ')'
  3554.         { expand_start_catch_block ($2, $3); }
  3555.     This allows reference parameters... */
  3556.     | '(' parm ')'
  3557.         { expand_start_catch_block (TREE_PURPOSE ($2),
  3558.                         TREE_VALUE ($2)); }
  3559.     ;
  3560.  
  3561. label_colon:
  3562.       IDENTIFIER ':'
  3563.         { tree label;
  3564.         do_label:
  3565.           label = define_label (input_filename, lineno, $1);
  3566.           if (label)
  3567.             expand_label (label);
  3568.         }
  3569.     | PTYPENAME ':'
  3570.         { goto do_label; }
  3571.     | TYPENAME ':'
  3572.         { goto do_label; }
  3573.     ;
  3574.  
  3575. for.init.statement:
  3576.       xexpr ';'
  3577.         { if ($1) cplus_expand_expr_stmt ($1); }
  3578.     | decl
  3579.     | '{' compstmtend
  3580.     ;
  3581.  
  3582. /* Either a type-qualifier or nothing.  First thing in an `asm' statement.  */
  3583.  
  3584. maybe_type_qual:
  3585.     /* empty */
  3586.         { emit_line_note (input_filename, lineno);
  3587.           $$ = NULL_TREE; }
  3588.     | TYPE_QUAL
  3589.         { emit_line_note (input_filename, lineno); }
  3590.     ;
  3591.  
  3592. xexpr:
  3593.     /* empty */
  3594.         { $$ = NULL_TREE; }
  3595.     | expr
  3596.     | error
  3597.         { $$ = NULL_TREE; }
  3598.     ;
  3599.  
  3600. /* These are the operands other than the first string and colon
  3601.    in  asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x))  */
  3602. asm_operands: /* empty */
  3603.         { $$ = NULL_TREE; }
  3604.     | nonnull_asm_operands
  3605.     ;
  3606.  
  3607. nonnull_asm_operands:
  3608.       asm_operand
  3609.     | nonnull_asm_operands ',' asm_operand
  3610.         { $$ = chainon ($$, $3); }
  3611.     ;
  3612.  
  3613. asm_operand:
  3614.       STRING '(' expr ')'
  3615.         { $$ = build_tree_list ($$, $3); }
  3616.     ;
  3617.  
  3618. asm_clobbers:
  3619.       STRING
  3620.         { $$ = tree_cons (NULL_TREE, $$, NULL_TREE); }
  3621.     | asm_clobbers ',' STRING
  3622.         { $$ = tree_cons (NULL_TREE, $3, $$); }
  3623.     ;
  3624.  
  3625. /* This is what appears inside the parens in a function declarator.
  3626.    Its value is represented in the format that grokdeclarator expects.
  3627.  
  3628.    In C++, declaring a function with no parameters
  3629.    means that that function takes *no* parameters.  */
  3630.  
  3631. parmlist:  /* empty */
  3632.         {
  3633.           if (strict_prototype)
  3634.             $$ = void_list_node;
  3635.           else
  3636.             $$ = NULL_TREE;
  3637.         }
  3638.     | complex_parmlist
  3639.     | type_id
  3640.         { $$ = tree_cons (NULL_TREE, $$, void_list_node);
  3641.           TREE_PARMLIST ($$) = 1; }
  3642.     ;
  3643.  
  3644. /* This nonterminal does not include the common sequence '(' type_id ')',
  3645.    as it is ambiguous and must be disambiguated elsewhere.  */
  3646. complex_parmlist:
  3647.       parms
  3648.         {
  3649.           $$ = chainon ($$, void_list_node);
  3650.           TREE_PARMLIST ($$) = 1;
  3651.         }
  3652.     | parms_comma ELLIPSIS
  3653.         {
  3654.           TREE_PARMLIST ($$) = 1;
  3655.         }
  3656.     /* C++ allows an ellipsis without a separating ',' */
  3657.     | parms ELLIPSIS
  3658.         {
  3659.           TREE_PARMLIST ($$) = 1;
  3660.         }
  3661.     | type_id ELLIPSIS
  3662.         {
  3663.           $$ = build_tree_list (NULL_TREE, $$); 
  3664.           TREE_PARMLIST ($$) = 1;
  3665.         }
  3666.     | ELLIPSIS
  3667.         {
  3668.           /* ARM $8.2.5 has this as a boxed-off comment.  */
  3669.           if (pedantic)
  3670.             warning ("use of `...' without a first argument is non-portable");
  3671.           $$ = NULL_TREE;
  3672.         }
  3673.     | TYPENAME_ELLIPSIS
  3674.         {
  3675.           TREE_PARMLIST ($$) = 1;
  3676.         }
  3677.     | parms TYPENAME_ELLIPSIS
  3678.         {
  3679.           TREE_PARMLIST ($$) = 1;
  3680.         }
  3681.     | type_id TYPENAME_ELLIPSIS
  3682.         {
  3683.           $$ = build_tree_list (NULL_TREE, $$);
  3684.           TREE_PARMLIST ($$) = 1;
  3685.         }
  3686.     | parms ':'
  3687.         {
  3688.           /* This helps us recover from really nasty
  3689.              parse errors, for example, a missing right
  3690.              parenthesis.  */
  3691.           yyerror ("possibly missing ')'");
  3692.           $$ = chainon ($$, void_list_node);
  3693.           TREE_PARMLIST ($$) = 1;
  3694.           yyungetc (':', 0);
  3695.           yychar = ')';
  3696.         }
  3697.     | type_id ':'
  3698.         {
  3699.           /* This helps us recover from really nasty
  3700.              parse errors, for example, a missing right
  3701.              parenthesis.  */
  3702.           yyerror ("possibly missing ')'");
  3703.           $$ = tree_cons (NULL_TREE, $$, void_list_node);
  3704.           TREE_PARMLIST ($$) = 1;
  3705.           yyungetc (':', 0);
  3706.           yychar = ')';
  3707.         }
  3708.     ;
  3709.  
  3710. /* A nonempty list of parameter declarations or type names.  */
  3711. parms:
  3712.       named_parm
  3713.         { $$ = build_tree_list (NULL_TREE, $$); }
  3714.     | parm '=' init
  3715.         { $$ = build_tree_list ($3, $$); }
  3716.     | parms_comma full_parm
  3717.         { $$ = chainon ($$, $2); }
  3718.     | parms_comma bad_parm
  3719.         { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); }
  3720.     | parms_comma bad_parm '=' init
  3721.         { $$ = chainon ($$, build_tree_list ($4, $2)); }
  3722.     ;
  3723.  
  3724. parms_comma:
  3725.       parms ','
  3726.     | type_id ','
  3727.         { $$ = build_tree_list (NULL_TREE, $$); }
  3728.     ;
  3729.  
  3730. /* A single parameter declaration or parameter type name,
  3731.    as found in a parmlist.  The first four cases make up for 10%
  3732.    of the time spent parsing C++.  We cannot use them because
  3733.    of `int id[]' which won't get parsed properly.  */
  3734. named_parm:
  3735. /*
  3736.       typed_declspecs dont_see_typename '*' IDENTIFIER
  3737.         { tree specs = strip_attrs ($1);
  3738.           $$ = build_tree_list (specs, build_parse_node (INDIRECT_REF, $4));
  3739.           see_typename (); }
  3740.     | typed_declspecs dont_see_typename '&' IDENTIFIER
  3741.         { tree specs = strip_attrs ($1);
  3742.           $$ = build_tree_list (specs, build_parse_node (ADDR_EXPR, $4));
  3743.           see_typename (); }
  3744.     | TYPENAME IDENTIFIER
  3745.         { $$ = build_tree_list (get_decl_list ($$), $2);  }
  3746.     | TYPESPEC IDENTIFIER
  3747.         { $$ = build_tree_list (get_decl_list ($$), $2); }
  3748.     | */
  3749.     /* Here we expand typed_declspecs inline to avoid mis-parsing of
  3750.        TYPESPEC IDENTIFIER.  */
  3751.       typed_declspecs1 declarator
  3752.         { tree specs = strip_attrs ($1);
  3753.           $$ = build_tree_list (specs, $2); }
  3754.     | typed_typespecs declarator
  3755.         { $$ = build_tree_list ($$, $2); }
  3756.     | typespec declarator
  3757.         { $$ = build_tree_list (get_decl_list ($$), $2); }
  3758.     | typed_declspecs1 absdcl
  3759.         { tree specs = strip_attrs ($1);
  3760.           $$ = build_tree_list (specs, $2); }
  3761.     | typed_declspecs1 %prec EMPTY
  3762.         { tree specs = strip_attrs ($1);
  3763.           $$ = build_tree_list (specs, NULL_TREE); }
  3764.     | declmods notype_declarator
  3765.         { tree specs = strip_attrs ($1);
  3766.           $$ = build_tree_list (specs, $2); }
  3767.     ;
  3768.  
  3769. full_parm:
  3770.       parm maybe_init
  3771.         { $$ = build_tree_list ($2, $$); }
  3772.     ;
  3773.  
  3774. parm:
  3775.     named_parm
  3776.     | type_id
  3777.     ;
  3778.  
  3779. see_typename: %prec EMPTY
  3780.     { see_typename (); }
  3781.     ;
  3782.  
  3783. /* 
  3784. dont_see_typename: %prec EMPTY
  3785.     { dont_see_typename (); }
  3786.     ; 
  3787.  
  3788. try_for_typename:
  3789.         {
  3790.       if ($<ttype>-1 == error_mark_node)
  3791.             $$ = 0;
  3792.           else
  3793.             {
  3794.               $$ = 1;
  3795.               pushclass ($<ttype>-1, 1);
  3796.             }
  3797.         }
  3798.     ;
  3799. */
  3800.  
  3801. bad_parm:
  3802.       /* empty */ %prec EMPTY
  3803.         {
  3804.           error ("type specifier omitted for parameter");
  3805.           $$ = build_tree_list (integer_type_node, NULL_TREE);
  3806.         }
  3807.     | notype_declarator
  3808.         {
  3809.           error ("type specifier omitted for parameter");
  3810.           $$ = build_tree_list (integer_type_node, $$);
  3811.         }
  3812.     ;
  3813.  
  3814. exception_specification_opt:
  3815.       %prec EMPTY /* empty */
  3816.         { $$ = NULL_TREE; }
  3817.     | THROW '(' ansi_raise_identifiers  ')' %prec EMPTY
  3818.         { $$ = $3; }
  3819.     | THROW LEFT_RIGHT %prec EMPTY
  3820.         { $$ = build_decl_list (NULL_TREE, NULL_TREE); }
  3821.     ;
  3822.  
  3823. ansi_raise_identifier:
  3824.       type_id
  3825.         { $$ = build_decl_list (NULL_TREE, groktypename($$)); }
  3826.     ;
  3827.  
  3828. ansi_raise_identifiers:
  3829.       ansi_raise_identifier
  3830.     | ansi_raise_identifiers ',' ansi_raise_identifier
  3831.         {
  3832.           TREE_CHAIN ($3) = $$;
  3833.           $$ = $3;
  3834.         }
  3835.     ;
  3836.  
  3837. conversion_declarator:
  3838.       /* empty */ %prec EMPTY
  3839.         { $$ = NULL_TREE; }
  3840.     | '*' type_quals conversion_declarator
  3841.         { $$ = make_pointer_declarator ($2, $3); }
  3842.     | '&' type_quals conversion_declarator
  3843.         { $$ = make_reference_declarator ($2, $3); }
  3844.     | ptr_to_mem type_quals conversion_declarator
  3845.         { tree arg = make_pointer_declarator ($2, $3);
  3846.           $$ = build_parse_node (SCOPE_REF, $1, arg);
  3847.         }
  3848.     ;
  3849.  
  3850. operator: OPERATOR
  3851.         { got_scope = NULL_TREE; }
  3852.     ;
  3853.  
  3854. operator_name:
  3855.       operator '*'
  3856.         { $$ = ansi_opname[MULT_EXPR]; }
  3857.     | operator '/'
  3858.         { $$ = ansi_opname[TRUNC_DIV_EXPR]; }
  3859.     | operator '%'
  3860.         { $$ = ansi_opname[TRUNC_MOD_EXPR]; }
  3861.     | operator '+'
  3862.         { $$ = ansi_opname[PLUS_EXPR]; }
  3863.     | operator '-'
  3864.         { $$ = ansi_opname[MINUS_EXPR]; }
  3865.     | operator '&'
  3866.         { $$ = ansi_opname[BIT_AND_EXPR]; }
  3867.     | operator '|'
  3868.         { $$ = ansi_opname[BIT_IOR_EXPR]; }
  3869.     | operator '^'
  3870.         { $$ = ansi_opname[BIT_XOR_EXPR]; }
  3871.     | operator '~'
  3872.         { $$ = ansi_opname[BIT_NOT_EXPR]; }
  3873.     | operator ','
  3874.         { $$ = ansi_opname[COMPOUND_EXPR]; }
  3875.     | operator ARITHCOMPARE
  3876.         { $$ = ansi_opname[$2]; }
  3877.     | operator '<'
  3878.         { $$ = ansi_opname[LT_EXPR]; }
  3879.     | operator '>'
  3880.         { $$ = ansi_opname[GT_EXPR]; }
  3881.     | operator EQCOMPARE
  3882.         { $$ = ansi_opname[$2]; }
  3883.     | operator ASSIGN
  3884.         { $$ = ansi_assopname[$2]; }
  3885.     | operator '='
  3886.         { $$ = ansi_opname [MODIFY_EXPR]; }
  3887.     | operator LSHIFT
  3888.         { $$ = ansi_opname[$2]; }
  3889.     | operator RSHIFT
  3890.         { $$ = ansi_opname[$2]; }
  3891.     | operator PLUSPLUS
  3892.         { $$ = ansi_opname[POSTINCREMENT_EXPR]; }
  3893.     | operator MINUSMINUS
  3894.         { $$ = ansi_opname[PREDECREMENT_EXPR]; }
  3895.     | operator ANDAND
  3896.         { $$ = ansi_opname[TRUTH_ANDIF_EXPR]; }
  3897.     | operator OROR
  3898.         { $$ = ansi_opname[TRUTH_ORIF_EXPR]; }
  3899.     | operator '!'
  3900.         { $$ = ansi_opname[TRUTH_NOT_EXPR]; }
  3901.     | operator '?' ':'
  3902.         { $$ = ansi_opname[COND_EXPR]; }
  3903.     | operator MIN_MAX
  3904.         { $$ = ansi_opname[$2]; }
  3905.     | operator POINTSAT  %prec EMPTY
  3906.         { $$ = ansi_opname[COMPONENT_REF]; }
  3907.     | operator POINTSAT_STAR  %prec EMPTY
  3908.         { $$ = ansi_opname[MEMBER_REF]; }
  3909.     | operator LEFT_RIGHT
  3910.         { $$ = ansi_opname[CALL_EXPR]; }
  3911.     | operator '[' ']'
  3912.         { $$ = ansi_opname[ARRAY_REF]; }
  3913.     | operator NEW %prec EMPTY
  3914.         { $$ = ansi_opname[NEW_EXPR]; }
  3915.     | operator DELETE %prec EMPTY
  3916.         { $$ = ansi_opname[DELETE_EXPR]; }
  3917.     | operator NEW '[' ']'
  3918.         { $$ = ansi_opname[VEC_NEW_EXPR]; }
  3919.     | operator DELETE '[' ']'
  3920.         { $$ = ansi_opname[VEC_DELETE_EXPR]; }
  3921.     /* Names here should be looked up in class scope ALSO.  */
  3922.     | operator type_specifier_seq conversion_declarator
  3923.         { $$ = grokoptypename ($2, $3); }
  3924.     | operator error
  3925.         { $$ = ansi_opname[ERROR_MARK]; }
  3926.     ;
  3927.  
  3928. %%
  3929.  
  3930. #ifdef SPEW_DEBUG
  3931. const char *
  3932. debug_yytranslate (value)
  3933.     int value;
  3934. {
  3935.   return yytname[YYTRANSLATE (value)];
  3936. }
  3937.  
  3938. #endif
  3939.