Skip to content

Commit 3abf117

Browse files
committed
cmd/compile: add test for array decomposition
This test fails on 1.9.2, but is ok on tip. CL 77331 has both the 1.9.2 fix and this test, and is on the 1.9 release branch. This CL is just the test, and is on HEAD. The buggy code doesn't exist on tip. Update #22683 Change-Id: I04a24bd6c2d3068e18ca81da3347e2c1366f4447 Reviewed-on: https://go-review.googlesource.com/77332 Run-TryBot: Keith Randall <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: David Chase <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent d50e952 commit 3abf117

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

test/fixedbugs/issue22683.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// cmpout
2+
3+
// Copyright 2017 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package main
8+
9+
import (
10+
"fmt"
11+
)
12+
13+
type foo struct {
14+
bar [1]*int
15+
}
16+
17+
func main() {
18+
ch := make(chan foo, 2)
19+
var a int
20+
var b [1]*int
21+
b[0] = &a
22+
ch <- foo{bar: b}
23+
close(ch)
24+
25+
for v := range ch {
26+
for i := 0; i < 1; i++ {
27+
fmt.Println(v.bar[0] != nil)
28+
}
29+
}
30+
}

test/fixedbugs/issue22683.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
true

0 commit comments

Comments
 (0)