diff options
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/value.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/reflect/value.go b/src/reflect/value.go index 95a650823..dd2691bee 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -276,7 +276,9 @@ func (v Value) Addr() Value { if !v.CanAddr() { panic("reflect.Value.Addr of unaddressable value") } - flags := (v.flags & (valueFlagExported)) | v.flags.ro() + // Preserve flagRO instead of using v.flag.ro() so that + // v.Addr().Elem() is equivalent to v (#32772) + flags := v.flags & (valueFlagExported | valueFlagRO) return Value{ typecode: pointerTo(v.typecode), value: v.value, |