The Go builtin functions other than append don't handle using ... to pass a varargs argument. This patch to the gccgo frontend checks for that. It also gives a better error message for an attempt to use ... with a type conversion. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r e304fc5e4c8c go/expressions.cc --- a/go/expressions.cc Fri Mar 25 22:44:29 2011 -0700 +++ b/go/expressions.cc Fri Mar 25 23:02:05 2011 -0700 @@ -6672,6 +6672,12 @@ 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 -r e304fc5e4c8c go/parse.cc --- a/go/parse.cc Fri Mar 25 22:44:29 2011 -0700 +++ b/go/parse.cc Fri Mar 25 23:02:05 2011 -0700 @@ -2705,6 +2705,12 @@ 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