diff options
author | Russ Cox <rsc@golang.org> | 2009-12-03 00:51:03 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-12-03 00:51:03 -0800 |
commit | 4208d02d7dabecb1552b9d6d8b647f8a5d2b15c1 (patch) | |
tree | e57459052baa096e97cbc54bdb8b66954ad9e6e0 /test/fixedbugs/bug223.go | |
parent | 31d4eb6c6ab65a8b3911f759aa86a88006263a69 (diff) | |
download | go-4208d02d7dabecb1552b9d6d8b647f8a5d2b15c1.tar.gz |
gc: better diagnosis of initialization loops
Fixes bug 292.
R=ken2
http://codereview.appspot.com/164093
Diffstat (limited to 'test/fixedbugs/bug223.go')
-rw-r--r-- | test/fixedbugs/bug223.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/fixedbugs/bug223.go b/test/fixedbugs/bug223.go new file mode 100644 index 000000000..80f9cae81 --- /dev/null +++ b/test/fixedbugs/bug223.go @@ -0,0 +1,21 @@ +// (! $G $D/$F.go) | grep 'initialization loop' >/dev/null || echo BUG: bug223 + +// Copyright 2009 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. + +// check that initialization loop is diagnosed +// and that closure cannot be used to hide it. +// error message is not standard format, so no errchk above. + +package main + +type F func() + +func f() { + if true { + _ = func() { _ = m } + } +} + +var m = map[string]F{"f": f} |