cmd/compile: prevent Noalg from breaking user types

Use a separate symbol for reflect metadata for types with Noalg set.

Fixes #17752.

Change-Id: Icb6cade7e3004fc4108f67df61105dc4085cd7e2
Reviewed-on: https://go-review.googlesource.com/32679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2016-11-03 15:58:55 -07:00
parent fa77001648
commit 3797446150
3 changed files with 28 additions and 2 deletions

View file

@ -928,7 +928,14 @@ func dcommontype(s *Sym, ot int, t *Type) int {
}
func typesym(t *Type) *Sym {
return Pkglookup(t.tconv(FmtLeft), typepkg)
name := t.tconv(FmtLeft)
// Use a separate symbol name for Noalg types for #17752.
if a, bad := algtype1(t); a == ANOEQ && bad.Noalg {
name = "noalg." + name
}
return Pkglookup(name, typepkg)
}
// tracksym returns the symbol for tracking use of field/method f, assumed