diff options
author | Damian Gryski <[email protected]> | 2023-03-30 13:50:50 -0700 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-03-31 01:08:04 +0200 |
commit | e6ccdd9d1a2263f2e55982451c4a980c119e8167 (patch) | |
tree | 81f8f166df29bcdd5d6e5daf128dbf4637513877 /src/reflect | |
parent | b39a982067f24c22036c659f817302cac777f319 (diff) | |
download | tinygo-e6ccdd9d1a2263f2e55982451c4a980c119e8167.tar.gz tinygo-e6ccdd9d1a2263f2e55982451c4a980c119e8167.zip |
reflect: another obscure RO bug
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, |