Skip to content

Commit caf9fc3

Browse files
committed
Revert "reflect: handle zero-sized fields of directly-stored structures correctly"
This reverts commit b338856 (CL 694195) Reason for revert: still causing compiler failures on Google test code Change-Id: I2a9b0f9a57fe2b6977238bbfbefb572545210b9f Reviewed-on: https://go-review.googlesource.com/c/go/+/694995 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent ce3f3e2 commit caf9fc3

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

src/reflect/value.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,17 +1277,6 @@ func (v Value) Field(i int) Value {
12771277
fl |= flagStickyRO
12781278
}
12791279
}
1280-
if fl&flagIndir == 0 && typ.Size() == 0 {
1281-
// Special case for picking a field out of a direct struct.
1282-
// A direct struct must have a pointer field and possibly a
1283-
// bunch of zero-sized fields. We must return the zero-sized
1284-
// fields indirectly, as only ptr-shaped things can be direct.
1285-
// See issue 74935.
1286-
// We use nil instead of v.ptr as it doesn't matter and
1287-
// we can avoid pinning a possibly now-unused object.
1288-
return Value{typ, nil, fl | flagIndir}
1289-
}
1290-
12911280
// Either flagIndir is set and v.ptr points at struct,
12921281
// or flagIndir is not set and v.ptr is the actual struct data.
12931282
// In the former case, we want v.ptr + offset.

test/fixedbugs/issue74935.go

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)