commit | 7feb424928605b51979e0bda3bbad139fcf2bb51 | [log] [tgz] |
---|---|---|
author | Russ Cox <rsc@golang.org> | Wed Jul 15 00:01:54 2015 -0400 |
committer | Russ Cox <rsc@golang.org> | Wed Jul 15 05:36:27 2015 +0000 |
tree | 2503840688720988e43ebd0668971bb6639725b2 | |
parent | bed6326a3c04811f394490b537c07c863b3df6de [diff] [blame] |
cmd/compile: fix PtrTo(t) for unnamed t with embedded fields Fixes #8427. Change-Id: I826a3bc4519845ad30d6dbaf058fe7ed7bee8db0 Reviewed-on: https://go-review.googlesource.com/12233 Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index 08343e8..fcb9b17 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go
@@ -760,10 +760,11 @@ } var sptr *Sym - if t.Sym != nil && !Isptr[t.Etype] { - sptr = dtypesym(Ptrto(t)) + tptr := Ptrto(t) + if !Isptr[t.Etype] && (t.Sym != nil || methods(tptr) != nil) { + sptr = dtypesym(tptr) } else { - sptr = weaktypesym(Ptrto(t)) + sptr = weaktypesym(tptr) } // All (non-reflect-allocated) Types share the same zero object.