aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-12-05 00:53:44 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-12-05 00:53:44 +0000
commitd59a4c82a6fc608880b83b4339b9721ead432e95 (patch)
tree3d75810243ea981e4f6f0f67dc1a584d44ac9a0a /gcc/go
parent54d04de72b3232ec654ea4824f8b1e37f0cb1961 (diff)
downloadgcc-d59a4c82a6fc608880b83b4339b9721ead432e95.zip
gcc-d59a4c82a6fc608880b83b4339b9721ead432e95.tar.gz
gcc-d59a4c82a6fc608880b83b4339b9721ead432e95.tar.bz2
compiler: Make sure we produce an error for a call to a non-function.
Fixes issue 19. From-SVN: r194174
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/expressions.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 3734d9b..9da9414 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -8544,6 +8544,16 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function,
return Expression::make_cast(this->fn_->type(), this->args_->front(),
loc);
+ // Because do_type will return an error type and thus prevent future
+ // errors, check for that case now to ensure that the error gets
+ // reported.
+ if (this->get_function_type() == NULL)
+ {
+ if (!this->fn_->type()->is_error())
+ this->report_error(_("expected function"));
+ return Expression::make_error(loc);
+ }
+
// Recognize a call to a builtin function.
Func_expression* fne = this->fn_->func_expression();
if (fne != NULL