@@ -6073,7 +6073,7 @@ convert_arg_to_ellipsis (tree arg)
/* va_arg (EXPR, TYPE) is a builtin. Make sure it is not abused. */
tree
-build_x_va_arg (tree expr, tree type)
+build_x_va_arg (source_location loc, tree expr, tree type)
{
if (processing_template_decl)
return build_min (VA_ARG_EXPR, type, expr);
@@ -6099,7 +6099,7 @@ build_x_va_arg (tree expr, tree type)
return expr;
}
- return build_va_arg (input_location, expr, type);
+ return build_va_arg (loc, expr, type);
}
/* TYPE has been given to va_arg. Apply the default conversions which
@@ -4886,7 +4886,7 @@ extern void push_defarg_context (tree);
extern void pop_defarg_context (void);
extern tree convert_default_arg (tree, tree, tree, int);
extern tree convert_arg_to_ellipsis (tree);
-extern tree build_x_va_arg (tree, tree);
+extern tree build_x_va_arg (source_location, tree, tree);
extern tree cxx_type_promotes_to (tree);
extern tree type_passed_as (tree);
extern tree convert_for_arg_passing (tree, tree);
@@ -4168,6 +4168,7 @@ cp_parser_primary_expression (cp_parser *parser,
{
tree expression;
tree type;
+ source_location type_location;
/* The `__builtin_va_arg' construct is used to handle
`va_arg'. Consume the `__builtin_va_arg' token. */
@@ -4179,6 +4180,7 @@ cp_parser_primary_expression (cp_parser *parser,
/*cast_p=*/false, NULL);
/* Look for the `,'. */
cp_parser_require (parser, CPP_COMMA, RT_COMMA);
+ type_location = cp_lexer_peek_token (parser->lexer)->location;
/* Parse the type-id. */
type = cp_parser_type_id (parser);
/* Look for the closing `)'. */
@@ -4188,7 +4190,7 @@ cp_parser_primary_expression (cp_parser *parser,
if (cp_parser_non_integral_constant_expression (parser,
NIC_VA_ARG))
return error_mark_node;
- return build_x_va_arg (expression, type);
+ return build_x_va_arg (type_location, expression, type);
}
case RID_OFFSETOF:
@@ -12440,7 +12440,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
gcc_unreachable ();
case VA_ARG_EXPR:
- return build_x_va_arg (tsubst_copy (TREE_OPERAND (t, 0), args, complain,
+ return build_x_va_arg (EXPR_LOCATION (t),
+ tsubst_copy (TREE_OPERAND (t, 0), args, complain,
in_decl),
tsubst (TREE_TYPE (t), args, complain, in_decl));
@@ -14273,7 +14274,8 @@ tsubst_copy_and_build (tree t,
}
case VA_ARG_EXPR:
- return build_x_va_arg (RECUR (TREE_OPERAND (t, 0)),
+ return build_x_va_arg (EXPR_LOCATION (t),
+ RECUR (TREE_OPERAND (t, 0)),
tsubst (TREE_TYPE (t), args, complain, in_decl));
case OFFSETOF_EXPR: