Commit 530f4f43 by Ian Lance Taylor

Check for invalid uses of ... in builtin function calls.

From-SVN: r171544
parent f082c000
......@@ -6672,6 +6672,12 @@ Find_call_expression::expression(Expression** pexpr)
Expression*
Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function, int)
{
if (this->is_varargs() && this->code_ != BUILTIN_APPEND)
{
this->report_error(_("invalid use of %<...%> with builtin function"));
return Expression::make_error(this->location());
}
if (this->code_ == BUILTIN_NEW)
{
const Expression_list* args = this->args();
......
......@@ -2705,6 +2705,12 @@ Parse::primary_expr(bool may_be_sink, bool may_be_composite_lit,
this->advance_token();
Expression* expr = this->expression(PRECEDENCE_NORMAL, false, true,
NULL);
if (this->peek_token()->is_op(OPERATOR_ELLIPSIS))
{
error_at(this->location(),
"invalid use of %<...%> in type conversion");
this->advance_token();
}
if (!this->peek_token()->is_op(OPERATOR_RPAREN))
error_at(this->location(), "expected %<)%>");
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment