Skip to content

Commit

Permalink
gc: issue 1231
Browse files Browse the repository at this point in the history
Fixes #1231.

R=ken2
CC=golang-dev
https://golang.org/cl/3627041
  • Loading branch information
rsc committed Dec 13, 2010
1 parent dc9a3b2 commit 1b31c37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/gc/gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ cgen_discard(Node *nr)

switch(nr->op) {
case ONAME:
if(!(nr->class & PHEAP) && nr->class != PEXTERN && nr->class != PFUNC)
if(!(nr->class & PHEAP) && nr->class != PEXTERN && nr->class != PFUNC && nr->class != PPARAMREF)
gused(nr);
break;

Expand Down
11 changes: 11 additions & 0 deletions test/closure.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,15 @@ func main() {
println("newfunc returned broken funcs")
panic("fail")
}

ff(1)
}

func ff(x int) {
call(func() {
_ = x
})
}

func call(func()) {
}

0 comments on commit 1b31c37

Please sign in to comment.