Skip to content

Commit 448d30b

Browse files
Chris Manghaneianlancetaylor
Chris Manghane
authored andcommitted
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. Change-Id: If6f4f0b1336b676238b7aa766a931ebdc2de2081 Reviewed-on: https://go-review.googlesource.com/13245 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent fc9da31 commit 448d30b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

go/gogo.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,11 @@ Gogo::declare_function(const std::string& name, Function_type* type,
19271927
return ftype->add_method_declaration(name, NULL, type, location);
19281928
}
19291929
else
1930-
go_unreachable();
1930+
{
1931+
error_at(type->receiver()->location(),
1932+
"invalid receiver type (receiver must be a named type)");
1933+
return Named_object::make_erroneous_name(name);
1934+
}
19311935
}
19321936
}
19331937

0 commit comments

Comments
 (0)