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.

Change-Id: If6f4f0b1336b676238b7aa766a931ebdc2de2081
Reviewed-on: https://go-review.googlesource.com/13245
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
Chris Manghane authored and ianlancetaylor committed Aug 14, 2015
1 parent fc9da31 commit 448d30b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/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 448d30b

Please sign in to comment.