diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-22 04:09:04 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-01-22 04:09:04 +0000 |
commit | c33af8e47da832638e724164af97953231833838 (patch) | |
tree | e74687ac05ead0fd2cff7c9955ddd16a4dfc124c /gcc/go/gofrontend/expressions.cc | |
parent | 61a2791bc20a058136ef4bfb1df848f8597a4e0a (diff) | |
download | gcc-c33af8e47da832638e724164af97953231833838.tar.gz |
compiler: Prohibit use of ellipsis operator on multi-valued calls.
Fixes golang/go#9525.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219984 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/gofrontend/expressions.cc')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index ee8af849f50..a8bed0b66e1 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -8580,6 +8580,17 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function, { Call_expression* call = this->args_->front()->call_expression(); call->set_is_multi_value_arg(); + if (this->is_varargs_) + { + // It is not clear which result of a multiple result call + // the ellipsis operator should be applied to. If we unpack the + // the call into its individual results here, the ellipsis will be + // applied to the last result. + error_at(call->location(), + _("multiple-value argument in single-value context")); + return Expression::make_error(call->location()); + } + Expression_list* args = new Expression_list; for (size_t i = 0; i < rc; ++i) args->push_back(Expression::make_call_result(call, i)); |