diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-14 17:26:27 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-14 17:26:27 +0000 |
commit | 624c7bbf6ccacf79c67279587dd8cf552b2ec93a (patch) | |
tree | 21245a8a21af63dbcdd8b3fff3ddbc2c5e7b305b | |
parent | e37dcf4530a0801513792535629542f50110b198 (diff) | |
download | gcc-624c7bbf6ccacf79c67279587dd8cf552b2ec93a.zip gcc-624c7bbf6ccacf79c67279587dd8cf552b2ec93a.tar.gz gcc-624c7bbf6ccacf79c67279587dd8cf552b2ec93a.tar.bz2 |
compiler: Report unnamed receiver types.
gccgo used to crash when presented with an invalid receiver type in a
method. Instead, unnamed receiver types should report an error.
Fixes golang/go#11557.
Reviewed-on: https://go-review.googlesource.com/13245
From-SVN: r226899
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 1961c7e..10f8b04 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -fc9da313b4f5c13b4ac3bdddd98e699fd1c89613 +448d30b696461a39870d1b8beb1195e411300bfd The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 9a5dd57..134e037 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -1927,7 +1927,11 @@ Gogo::declare_function(const std::string& name, Function_type* type, return ftype->add_method_declaration(name, NULL, type, location); } else - go_unreachable(); + { + error_at(type->receiver()->location(), + "invalid receiver type (receiver must be a named type)"); + return Named_object::make_erroneous_name(name); + } } } |