mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
disable the optimization of skipping assign operation in that case, as this step is necessary in case of writing to a pointer. Fixes #1300.
21 lines
219 B
Go
21 lines
219 B
Go
package main
|
|
|
|
const buflen = 512
|
|
|
|
type T struct {
|
|
buf []byte
|
|
}
|
|
|
|
func f(t *T) { *t = T{buf: make([]byte, 0, buflen)} }
|
|
|
|
func main() {
|
|
s := T{}
|
|
println(cap(s.buf))
|
|
f(&s)
|
|
println(cap(s.buf))
|
|
}
|
|
|
|
// Output:
|
|
// 0
|
|
// 512
|