llvm-gcc-4.2-2.9/gcc/cp/parser.c
/* Parse a new-expression.

   new-expression:
     :: [opt] new new-placement [opt] new-type-id new-initializer [opt]
     :: [opt] new new-placement [opt] ( type-id ) new-initializer [opt]

   Returns a representation of the expression.  */
Parse a new-expression.

Returns a representation of the expression.
Parse a new - expression . Returns a representation of the expression .
static tree
cp_parser_new_expression (cp_parser* parser)
{
  bool global_scope_p;
  tree placement;
  tree type;
  tree initializer;
  tree nelts;
  global_scope_p
    = (cp_parser_global_scope_opt (parser,
				   false)
       != NULL_TREE);
  cp_parser_require_keyword (parser, RID_NEW, "`new'");
  cp_parser_parse_tentatively (parser);
  placement = cp_parser_new_placement (parser);
  if (!cp_parser_parse_definitely (parser))
    placement = NULL_TREE;
  if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
    {
      cp_lexer_consume_token (parser->lexer);
      type = cp_parser_type_id (parser);
      cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
      if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_SQUARE))
	{
	  error ("array bound forbidden after parenthesized type-id");
	  inform ("try removing the parentheses around the type-id");
	  cp_parser_direct_new_declarator (parser);
	}
      nelts = NULL_TREE;
    }
  else
    type = cp_parser_new_type_id (parser, &nelts);
  if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
    initializer = cp_parser_new_initializer (parser);
  else
    initializer = NULL_TREE;
  if (cp_parser_non_integral_constant_expression (parser, "`new'"))
    return error_mark_node;
  return build_new (placement, type, nelts, initializer, global_scope_p);
}
static tree cp_parser_new_expression ( cp_parser * parser ) { bool global_scope_p ; tree placement ; tree type ; tree initializer ; tree nelts ; global_scope_p = ( cp_parser_global_scope_opt ( parser , false ) != NULL_TREE ) ; cp_parser_require_keyword ( parser , RID_NEW , " " ) ; cp_parser_parse_tentatively ( parser ) ; placement = cp_parser_new_placement ( parser ) ; if ( ! cp_parser_parse_definitely ( parser ) ) placement = NULL_TREE ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_OPEN_PAREN ) ) { cp_lexer_consume_token ( parser -> lexer ) ; type = cp_parser_type_id ( parser ) ; cp_parser_require ( parser , CPP_CLOSE_PAREN , " " ) ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_OPEN_SQUARE ) ) { error ( " " ) ; inform ( " " ) ; cp_parser_direct_new_declarator ( parser ) ; } nelts = NULL_TREE ; } else type = cp_parser_new_type_id ( parser , & nelts ) ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_OPEN_PAREN ) ) initializer = cp_parser_new_initializer ( parser ) ; else initializer = NULL_TREE ; if ( cp_parser_non_integral_constant_expression ( parser , " " ) ) return error_mark_node ; return build_new ( placement , type , nelts , initializer , global_scope_p ) ; }
Parse a new-expression.
Parse a new - expression .
/* Look for the optional `::' operator.  */ /*current_scope_valid_p=*/ /* Look for the `new' operator.  */ /* There's no easy way to tell a new-placement from the
     `( type-id )' construct.  */ /* Look for a new-placement.  */ /* If that didn't work out, there's no new-placement.  */ /* If the next token is a `(', then we have a parenthesized
     type-id.  */ /* Consume the `('.  */ /* Parse the type-id.  */ /* Look for the closing `)'.  */ /* There should not be a direct-new-declarator in this production,
	 but GCC used to allowed this, so we check and emit a sensible error
	 message for this case.  */ /* Otherwise, there must be a new-type-id.  */ /* If the next token is a `(', then we have a new-initializer.  */ /* A new-expression may not appear in an integral constant
     expression.  */ /* Create a representation of the new-expression.  */