1
0
mirror of https://github.com/golang/go synced 2024-11-12 08:20:22 -07:00

cmd/gc: add missing dupok flag for interface method wrappers.

R=rsc
CC=golang-codereviews
https://golang.org/cl/48420044
This commit is contained in:
Rémy Oudompheng 2014-01-07 18:25:11 +01:00
parent 9a7fb68359
commit 095de8795a

View File

@ -2591,8 +2591,10 @@ genwrapper(Type *rcvr, Type *method, Sym *newnam, int iface)
funcbody(fn);
curfn = fn;
// wrappers where T is anonymous (struct{ NamedType }) can be duplicated.
if(rcvr->etype == TSTRUCT || isptr[rcvr->etype] && rcvr->type->etype == TSTRUCT)
// wrappers where T is anonymous (struct or interface) can be duplicated.
if(rcvr->etype == TSTRUCT ||
rcvr->etype == TINTER ||
isptr[rcvr->etype] && rcvr->type->etype == TSTRUCT)
fn->dupok = 1;
typecheck(&fn, Etop);
typechecklist(fn->nbody, Etop);