diff options
author | Russ Cox <rsc@golang.org> | 2012-02-10 23:10:45 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2012-02-10 23:10:45 -0500 |
commit | c2804307d14a6b6e510d865f8cc19b569741a4d2 (patch) | |
tree | 2477c018c1447857cc4f4b61f5e8ec770c7b2954 /test | |
parent | 01e0864983bfeb047452ceca706690c116edc866 (diff) | |
download | go-c2804307d14a6b6e510d865f8cc19b569741a4d2.tar.gz |
gc: diagnose init loop involving func
Fixes issue 2295.
R=ken2
CC=golang-dev
http://codereview.appspot.com/5655057
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/bug413.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/fixedbugs/bug413.go b/test/fixedbugs/bug413.go new file mode 100644 index 000000000..32b7efc76 --- /dev/null +++ b/test/fixedbugs/bug413.go @@ -0,0 +1,11 @@ +// errchk $G $D/$F.go + +// Copyright 2012 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. + +package p + +func f(i int) int { return i } + +var i = func() int {a := f(i); return a}() // ERROR "initialization loop"
\ No newline at end of file |