diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-12-12 20:42:24 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-12-12 20:42:24 +0000 |
commit | 3a24b26591ef6a0f19901ddc4fd7931c9297b899 (patch) | |
tree | 6fbecceb197151003eaf6012adaf0892a7041e14 /gcc/go | |
parent | 1635eab367caf9615b4156090fbcd4251fd46e32 (diff) | |
download | gcc-3a24b26591ef6a0f19901ddc4fd7931c9297b899.zip gcc-3a24b26591ef6a0f19901ddc4fd7931c9297b899.tar.gz gcc-3a24b26591ef6a0f19901ddc4fd7931c9297b899.tar.bz2 |
compiler: Tweak untyped nil error message.
From-SVN: r205941
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 4f9368e..a5a056b 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -7310,7 +7310,11 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function, Type* slice_type = args->front()->type(); if (!slice_type->is_slice_type()) { - error_at(args->front()->location(), "argument 1 must be a slice"); + if (slice_type->is_nil_type()) + error_at(args->front()->location(), "use of untyped nil"); + else + error_at(args->front()->location(), + "argument 1 must be a slice"); this->set_is_error(); return this; } @@ -8008,7 +8012,10 @@ Builtin_call_expression::do_type() const Expression_list* args = this->args(); if (args == NULL || args->empty()) return Type::make_error_type(); - return args->front()->type(); + Type *ret = args->front()->type(); + if (!ret->is_slice_type()) + return Type::make_error_type(); + return ret; } case BUILTIN_REAL: |