diff options
author | Luuk van Dijk <lvd@golang.org> | 2012-02-06 15:41:01 +0100 |
---|---|---|
committer | Luuk van Dijk <lvd@golang.org> | 2012-02-06 15:41:01 +0100 |
commit | 1ce04f99c4b0cdcfe91a5e414abce8f32048dbe6 (patch) | |
tree | 8cefca3154de5af46b0acf840827f5016b495600 /test | |
parent | 7afec9463d46d11ab4f730efbac53476b0029fac (diff) | |
download | go-1ce04f99c4b0cdcfe91a5e414abce8f32048dbe6.tar.gz |
cmd/gc: fix codegen reordering for expressions involving && and ||
Fixes issue 2821.
R=rsc
CC=golang-dev
http://codereview.appspot.com/5606061
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/bug406.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/fixedbugs/bug406.go b/test/fixedbugs/bug406.go new file mode 100644 index 000000000..9d755045b --- /dev/null +++ b/test/fixedbugs/bug406.go @@ -0,0 +1,25 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out || echo "Bug406" + +// 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. + +// Issue 2821 +package main + +type matrix struct { + e []int +} + +func (a matrix) equal() bool { + for _ = range a.e { + } + return true +} + +func main() { + var a matrix + var i interface{} + i = true && a.equal() + _ = i +} |