aboutsummaryrefslogtreecommitdiff
path: root/test/cmp.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-02-17 14:45:29 -0500
committerRuss Cox <rsc@golang.org>2012-02-17 14:45:29 -0500
commitc4c92ebeb656d059f88a2164f6ca9b136ce9fbf9 (patch)
treef314af2a334beffe7071f4a959ef2328db4e1ab0 /test/cmp.go
parentce020ffacd8c43e1682e2c83db6d1e7f0c305eea (diff)
downloadgo-c4c92ebeb656d059f88a2164f6ca9b136ce9fbf9.tar.gz
go-c4c92ebeb656d059f88a2164f6ca9b136ce9fbf9.zip
cmd/gc: fix comparison of struct with _ field
Fixes #2989. R=ken2 CC=golang-dev https://golang.org/cl/5674091
Diffstat (limited to 'test/cmp.go')
-rw-r--r--test/cmp.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/cmp.go b/test/cmp.go
index 795245f2f5..a9d0375b24 100644
--- a/test/cmp.go
+++ b/test/cmp.go
@@ -281,6 +281,25 @@ func main() {
isfalse(ix != z)
isfalse(iz != x)
}
+
+ // structs with _ fields
+ {
+ var x = struct {
+ x int
+ _ []int
+ y float64
+ _ float64
+ z int
+ }{
+ x: 1, y: 2, z: 3,
+ }
+ var ix interface{} = x
+
+ istrue(x == x)
+ istrue(x == ix)
+ istrue(ix == x)
+ istrue(ix == ix)
+ }
// arrays
{