-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug/gnovm] arrays returned by functions should not be addressable #2299
Milestone
Comments
I think, this might be a clearer example of the problem. package main
func main() {
foo()[:] // ./prog.go:4:2: invalid operation: foo() (value of type [2]byte) (slice of unaddressable value)
}
func foo() [2]byte {
return [2]byte{1, 2}
} |
This also works, when it shouldn't. func main() {
arr := &getArray()[0]
println(arr)
}
func getArray() [3]int {
return [3]int{1, 2, 3}
} and this type Point struct {
X, Y int
}
func main() {
arr := &[3]Point{{1, 2}, {3, 4}, {5, 6}}[0]
println(arr)
} |
Should mostly be fixed by Dylan. We can continue Dylan's work. Maxwell will take it up. |
Merged
petar-dambovaliev
added a commit
that referenced
this issue
Jan 20, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This bug highlights a difference between gno and go. Here is an example
This will execute fine as gno code, but running it as go code yields
invalid operation: sha256.Sum256([]byte("x")) (value of type [32]byte) (slice of unaddressable value)
https://goplay.tools/snippet/MxwoBhtYZzz
The text was updated successfully, but these errors were encountered: