diff options
author | Ian Lance Taylor <iant@golang.org> | 2014-08-04 19:50:49 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2014-08-04 19:50:49 -0700 |
commit | c2e58b03048cacc2b1b8fbf82914690f6285ece5 (patch) | |
tree | d9125e8cf29643b3d171d759011c91732c16d929 /test | |
parent | a5fb892c9ea618042a2fbc3dc05a9aa547e2036a (diff) | |
download | go-c2e58b03048cacc2b1b8fbf82914690f6285ece5.tar.gz |
test: add test for function type in function literal
The gccgo compiler used to fail this test. This was the root
cause of http://gcc.gnu.org/PR61308 . The fix for the gccgo
compiler is http://codereview.appspot.com/122020043 .
LGTM=dave, bradfitz
R=golang-codereviews, dave, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/121200043
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/bug489.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/fixedbugs/bug489.go b/test/fixedbugs/bug489.go new file mode 100644 index 000000000..4cf19e059 --- /dev/null +++ b/test/fixedbugs/bug489.go @@ -0,0 +1,22 @@ +// compile + +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The gccgo compiler had a bug: mentioning a function type in an +// expression in a function literal messed up the list of variables +// referenced in enclosing functions. + +package main + +func main() { + v1, v2 := 0, 0 + f := func() { + a := v1 + g := (func())(nil) + b := v2 + _, _, _ = a, g, b + } + _, _, _ = v1, v2, f +} |