compiler: Report unnamed receiver types.
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 14 Aug 2015 17:26:27 +0000 (17:26 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 14 Aug 2015 17:26:27 +0000 (17:26 +0000)
    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

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

index 1961c7ea6ff56353ddd57ffc64bf47935aa8294a..10f8b043e06c6df211b35bd28551d3a8e65c96f9 100644 (file)
@@ -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.
index 9a5dd57cdb56ed855f76c699c8272ac5170932ea..134e03794619ee121c22a818361d02c8c7ba459d 100644 (file)
@@ -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);
+        }
     }
 }