diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-26 06:06:36 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-03-26 06:06:36 +0000 |
commit | 530f4f437a8d592e8203a40a860f246c7e1cdfca (patch) | |
tree | b0f37969140af40440f6d28ce859db74e01bf052 /gcc | |
parent | f082c000379548ab460bd02f94e2986491b72c9e (diff) | |
download | gcc-530f4f437a8d592e8203a40a860f246c7e1cdfca.zip gcc-530f4f437a8d592e8203a40a860f246c7e1cdfca.tar.gz gcc-530f4f437a8d592e8203a40a860f246c7e1cdfca.tar.bz2 |
Check for invalid uses of ... in builtin function calls.
From-SVN: r171544
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 6 | ||||
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 19ac03e..e3a3ab5 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 18310cc..76dd9d0 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 |