compiler: Report invalid receiver types in function definitions.
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 3 Sep 2015 04:33:32 +0000 (04:33 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 3 Sep 2015 04:33:32 +0000 (04:33 +0000)
    Fixes golang/go#12324.

    Reviewed-on: https://go-review.googlesource.com/13988

From-SVN: r227427

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc

index f74d2ca565b31d5f9b17f39658458ba1a647ae8b..9dea1f84115a17f26507e46e63151fca2ba2ad9f 100644 (file)
@@ -1,4 +1,4 @@
-3f8feb4f905535448833a14e4f5c83f682087749
+672ac2abc52d8bd70cb9fb03dd4a32fdde9c438f
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 233ee274cf0e0c726d8696a698f298f1eaaa0d41..5ecc55d0dbb1a6e78ad077dba1636b55b05e4917 100644 (file)
@@ -1818,7 +1818,11 @@ Gogo::start_function(const std::string& name, Function_type* type,
                                                                  function);
            }
          else
-           go_unreachable();
+            {
+              error_at(type->receiver()->location(),
+                       "invalid receiver type (receiver must be a named type)");
+              ret = Named_object::make_function(name, NULL, function);
+            }
        }
       this->package_->bindings()->add_method(ret);
     }