diff options
| author | Russ Cox <rsc@golang.org> | 2017-01-25 10:19:33 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2017-01-25 18:57:20 +0000 |
| commit | 9bbb07ddec63e5e747f1cd9dbf82b7504b29dd09 (patch) | |
| tree | 48983c3d3a5c0845f294d29bf541a5f529cfc7a2 /src/runtime | |
| parent | 43c70943861ce39b44e5bd577a8c3c2ef18538db (diff) | |
| download | go-9bbb07ddec63e5e747f1cd9dbf82b7504b29dd09.tar.xz | |
[dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune
Will also fix type aliases.
Fixes #17766.
For #18130.
Change-Id: I9e1584d47128782152e06abd0a30ef423d5c30d2
Reviewed-on: https://go-review.googlesource.com/35732
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/cgocall.go | 2 | ||||
| -rw-r--r-- | src/runtime/type.go | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go index 69e29ef976..879e786231 100644 --- a/src/runtime/cgocall.go +++ b/src/runtime/cgocall.go @@ -531,7 +531,7 @@ func cgoCheckArg(t *_type, p unsafe.Pointer, indir, top bool, msg string) { return } for _, f := range st.fields { - cgoCheckArg(f.typ, add(p, f.offset), true, top, msg) + cgoCheckArg(f.typ, add(p, f.offset()), true, top, msg) } case kindPtr, kindUnsafePointer: if indir { diff --git a/src/runtime/type.go b/src/runtime/type.go index 3ecc54c72c..10442eff69 100644 --- a/src/runtime/type.go +++ b/src/runtime/type.go @@ -390,9 +390,13 @@ type ptrtype struct { } type structfield struct { - name name - typ *_type - offset uintptr + name name + typ *_type + offsetAnon uintptr +} + +func (f *structfield) offset() uintptr { + return f.offsetAnon >> 1 } type structtype struct { @@ -650,7 +654,7 @@ func typesEqual(t, v *_type) bool { if tf.name.tag() != vf.name.tag() { return false } - if tf.offset != vf.offset { + if tf.offsetAnon != vf.offsetAnon { return false } } |
