From: Ian Lance Taylor Date: Sat, 26 Mar 2011 06:06:36 +0000 (+0000) Subject: Check for invalid uses of ... in builtin function calls. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=530f4f437a8d592e8203a40a860f246c7e1cdfca;p=gcc.git Check for invalid uses of ... in builtin function calls. From-SVN: r171544 --- diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 19ac03e9347..e3a3ab593ee 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -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(); diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 18310ccac29..76dd9d04e43 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -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