aboutsummaryrefslogtreecommitdiff
path: root/test/cmp6.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/cmp6.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/cmp6.go')
-rw-r--r--test/cmp6.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/cmp6.go b/test/cmp6.go
index 71f1284812..1e286750ab 100644
--- a/test/cmp6.go
+++ b/test/cmp6.go
@@ -15,6 +15,10 @@ type T3 struct{ z []int }
var t3 T3
+type T4 struct { _ []int; a float64 }
+
+var t4 T4
+
func main() {
// Arguments to comparison must be
// assignable one to the other (or vice versa)
@@ -46,6 +50,7 @@ func main() {
// Comparison of structs should have a good message
use(t3 == t3) // ERROR "struct|expected"
+ use(t4 == t4) // ok; the []int is a blank field
// Slices, functions, and maps too.
var x []int