Skip to content

Commit

Permalink
interp: fix type checking of address of multi dimension array
Browse files Browse the repository at this point in the history
Fixes #1177.
  • Loading branch information
mvertes committed Jul 8, 2021
1 parent 297b40d commit 15947d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions _test/issue-1177.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

type counters [3][16]int

func main() {
cs := &counters{}
p := &cs[0][1]
*p = 2
println(cs[0][1])
}

// Output:
// 2
1 change: 1 addition & 0 deletions interp/typecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (check typecheck) addressExpr(n *node) error {
c := c0.child[0]
if isArray(c.typ) || isMap(c.typ) {
c0 = c
found = true
continue
}
case compositeLitExpr, identExpr:
Expand Down

0 comments on commit 15947d9

Please sign in to comment.