aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/reflect
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2023-03-30 13:50:50 -0700
committerRon Evans <[email protected]>2023-03-31 01:08:04 +0200
commite6ccdd9d1a2263f2e55982451c4a980c119e8167 (patch)
tree81f8f166df29bcdd5d6e5daf128dbf4637513877 /src/reflect
parentb39a982067f24c22036c659f817302cac777f319 (diff)
downloadtinygo-e6ccdd9d1a2263f2e55982451c4a980c119e8167.tar.gz
tinygo-e6ccdd9d1a2263f2e55982451c4a980c119e8167.zip
reflect: another obscure RO bug
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/value.go4
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,