static tree cp_parser_question_colon_clause
(cp_parser *, tree);
static tree cp_parser_assignment_expression
- (cp_parser *, bool, cp_id_kind *);
+ (cp_parser *, cp_id_kind * = NULL, bool = false, bool = false);
static enum tree_code cp_parser_assignment_operator_opt
(cp_parser *);
static tree cp_parser_expression
(cp_parser *, cp_id_kind * = NULL, bool = false, bool = false);
static tree cp_parser_constant_expression
- (cp_parser *, bool, bool *);
+ (cp_parser *, bool = false, bool * = NULL);
static tree cp_parser_builtin_offsetof
(cp_parser *);
static tree cp_parser_lambda_expression
/* Look for the opening `('. */
cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN);
/* Now, parse the assignment-expression. */
- expression = cp_parser_assignment_expression (parser,
- /*cast_p=*/false, NULL);
+ expression = cp_parser_assignment_expression (parser);
/* Look for the `,'. */
cp_parser_require (parser, CPP_COMMA, RT_COMMA);
type_location = cp_lexer_peek_token (parser->lexer)->location;
Rather than open the barn door too wide right away, allow only integer
constant expressions here. */
if (for_offsetof)
- index = cp_parser_constant_expression (parser, false, NULL);
+ index = cp_parser_constant_expression (parser);
else
{
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
break;
}
if (expr == NULL_TREE)
- expr = cp_parser_assignment_expression (parser, cast_p,
- NULL);
+ expr = cp_parser_assignment_expression (parser, /*pidk=*/NULL,
+ cast_p);
}
if (fold_expr_p)
/* The next token should be a `:'. */
cp_parser_require (parser, CPP_COLON, RT_COLON);
/* Parse the assignment-expression. */
- assignment_expr = cp_parser_assignment_expression (parser, /*cast_p=*/false, NULL);
+ assignment_expr = cp_parser_assignment_expression (parser);
c_inhibit_evaluation_warnings -= logical_or_expr == truthvalue_true_node;
/* Build the conditional-expression. */
Returns a representation for the expression. */
static tree
-cp_parser_assignment_expression (cp_parser* parser, bool cast_p,
- bool decltype_p, cp_id_kind * pidk)
+cp_parser_assignment_expression (cp_parser* parser, cp_id_kind * pidk,
+ bool cast_p, bool decltype_p)
{
tree expr;
return expr;
}
-static tree
-cp_parser_assignment_expression (cp_parser* parser, bool cast_p,
- cp_id_kind * pidk)
-{
- return cp_parser_assignment_expression (parser, cast_p,
- /*decltype*/false, pidk);
-}
-
/* Parse an (optional) assignment-operator.
assignment-operator: one of
/* Parse the next assignment-expression. */
assignment_expression
- = cp_parser_assignment_expression (parser, cast_p, decltype_p, pidk);
+ = cp_parser_assignment_expression (parser, pidk, cast_p, decltype_p);
/* We don't create a temporary for a call that is the immediate operand
of decltype or on the RHS of a comma. But when we see a comma, we
For example, cp_parser_initializer_clauses uses this function to
determine whether a particular assignment-expression is in fact
constant. */
- expression = cp_parser_assignment_expression (parser, /*cast_p=*/false, NULL);
+ expression = cp_parser_assignment_expression (parser);
/* Restore the old settings. */
parser->integral_constant_expression_p
= saved_integral_constant_expression_p;
/* Consume the `case' token. */
cp_lexer_consume_token (parser->lexer);
/* Parse the constant-expression. */
- expr = cp_parser_constant_expression (parser,
- /*allow_non_constant_p=*/false,
- NULL);
+ expr = cp_parser_constant_expression (parser);
ellipsis = cp_lexer_peek_token (parser->lexer);
if (ellipsis->type == CPP_ELLIPSIS)
/* Consume the `...' token. */
cp_lexer_consume_token (parser->lexer);
expr_hi =
- cp_parser_constant_expression (parser,
- /*allow_non_constant_p=*/false,
- NULL);
+ cp_parser_constant_expression (parser);
+
/* We don't need to emit warnings here, as the common code
will do this for us. */
}
because the argument could really be a type-id. */
if (maybe_type_id)
cp_parser_parse_tentatively (parser);
- argument = cp_parser_constant_expression (parser,
- /*allow_non_constant_p=*/false,
- /*non_constant_p=*/NULL);
+ argument = cp_parser_constant_expression (parser);
+
if (!maybe_type_id)
return argument;
if (!cp_parser_next_token_ends_template_argument_p (parser))
/* Consume the `=' token. */
cp_lexer_consume_token (parser->lexer);
/* Parse the value. */
- value = cp_parser_constant_expression (parser,
- /*allow_non_constant_p=*/false,
- NULL);
+ value = cp_parser_constant_expression (parser);
}
else
value = NULL_TREE;
cp_lexer_consume_token (parser->lexer);
/* Get the width of the bitfield. */
width
- = cp_parser_constant_expression (parser,
- /*allow_non_constant=*/false,
- NULL);
+ = cp_parser_constant_expression (parser);
/* Look for attributes that apply to the bitfield. */
attributes = cp_parser_attributes_opt (parser);
return error_mark_node;
}
- return cp_parser_constant_expression (parser,
- /*allow_non_constant=*/false,
- NULL);
+ return cp_parser_constant_expression (parser);
}
/* Derived classes [gram.class.derived] */
parser->type_definition_forbidden_message
= G_("types may not be defined in an exception-specification");
- expr = cp_parser_constant_expression (parser, false, NULL);
+ expr = cp_parser_constant_expression (parser);
/* Restore the saved message. */
parser->type_definition_forbidden_message = saved_message;
|| token->type == CPP_COLON)
expression = NULL_TREE;
else
- expression = cp_parser_assignment_expression (parser,
- /*cast_p=*/false, NULL);
+ expression = cp_parser_assignment_expression (parser);
return build_throw (expression);
}
|| alignas_expr == NULL_TREE);
alignas_expr =
- cp_parser_assignment_expression (parser, /*cast_p=*/false,
- /**cp_id_kind=*/NULL);
+ cp_parser_assignment_expression (parser);
if (alignas_expr == error_mark_node)
cp_parser_skip_to_end_of_statement (parser);
if (alignas_expr == NULL_TREE
maybe_unary_selector_p = false;
cp_parser_require (parser, CPP_COLON, RT_COLON);
- arg = cp_parser_assignment_expression (parser, false, NULL);
+ arg = cp_parser_assignment_expression (parser);
sel_args
= chainon (sel_args,
tree arg;
cp_lexer_consume_token (parser->lexer);
- arg = cp_parser_assignment_expression (parser, false, NULL);
+ arg = cp_parser_assignment_expression (parser);
addl_args
= chainon (addl_args,
cp_lexer_consume_token (parser->lexer); /* Eat ':'. */
/* Get the width of the bitfield. */
width
- = cp_parser_constant_expression (parser,
- /*allow_non_constant=*/false,
- NULL);
+ = cp_parser_constant_expression (parser);
}
else
{
if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
return list;
- num = cp_parser_constant_expression (parser, false, NULL);
+ num = cp_parser_constant_expression (parser);
if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
cp_lexer_consume_token (parser->lexer);
token = cp_lexer_peek_token (parser->lexer);
- t = cp_parser_assignment_expression (parser, false, NULL);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node)
goto resync_fail;
if (colon)
{
- alignment = cp_parser_constant_expression (parser, false, NULL);
+ alignment = cp_parser_constant_expression (parser);
if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
cp_parser_skip_to_closing_parenthesis (parser, /*recovering=*/true,
if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
return list;
- t = cp_parser_constant_expression (parser, false, NULL);
+ t = cp_parser_constant_expression (parser);
if (t == error_mark_node
|| !cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
return list;
- t = cp_parser_constant_expression (parser, false, NULL);
+ t = cp_parser_constant_expression (parser);
if (t == error_mark_node
|| !cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
{
cp_lexer_consume_token (parser->lexer);
- t = cp_parser_assignment_expression (parser, false, NULL);
+ t = cp_parser_assignment_expression (parser);
if (t == error_mark_node)
goto resync_fail;
if (op != NOP_EXPR)
{
- rhs = cp_parser_assignment_expression (parser, false, NULL);
+ rhs = cp_parser_assignment_expression (parser);
rhs = build2 (op, TREE_TYPE (decl), decl, rhs);
return build2 (MODIFY_EXPR, TREE_TYPE (decl), decl, rhs);
}
{
/* Consume '='. */
cp_lexer_consume_token (parser->lexer);
- init = cp_parser_assignment_expression (parser, false, NULL);
+ init = cp_parser_assignment_expression (parser);
non_class:
if (TREE_CODE (TREE_TYPE (decl)) == REFERENCE_TYPE)
cp_parser_parse_definitely (parser);
cp_parser_require (parser, CPP_EQ, RT_EQ);
- rhs = cp_parser_assignment_expression (parser, false, NULL);
+ rhs = cp_parser_assignment_expression (parser);
finish_expr_stmt (build_x_modify_expr (EXPR_LOCATION (rhs),
decl, NOP_EXPR,
rhs,
if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
return error_mark_node;
- expr = cp_parser_constant_expression (parser, false, NULL);
+ expr = cp_parser_constant_expression (parser);
expr = maybe_constant_value (expr);
/* If expr == error_mark_node, then don't emit any errors nor
{
cp_lexer_consume_token (parser->lexer);
- e = cp_parser_assignment_expression (parser, false, NULL);
+ e = cp_parser_assignment_expression (parser);
e = maybe_constant_value (e);
if (e == error_mark_node)