Skip to content

Commit

Permalink
compiler: Report unnamed receiver types.
Browse files Browse the repository at this point in the history
    
    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


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226899 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
ian committed Aug 14, 2015
1 parent 1ad0822 commit 9ddf5f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gcc/go/gofrontend/MERGE
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 5 additions & 1 deletion gcc/go/gofrontend/gogo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 9ddf5f1

Please sign in to comment.