3 // Copyright 2009 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.
7 // Test interface comparisons using types hidden
8 // inside reflected-on structs.
31 func add(s, t string) string {
45 x.S = add("abc", "def")
46 x.T = add("abc", "def")
54 // check mem and string
55 v := reflect.ValueOf(x)
58 assert(i.Interface() == j.Interface())
62 assert(s.Interface() == t.Interface())
64 // make sure different values are different.
65 // make sure whole word is being compared,
66 // not just a single byte.
69 assert(i.Interface() != j.Interface())
73 assert(i.Interface() != j.Interface())
77 assert(i.Interface() == j.Interface())
81 comparing uncomparable type float32
82 throw: interface compare
85 throw+0x41 /Users/rsc/goX/src/runtime/runtime.c:54
87 ifaceeq+0x15c /Users/rsc/goX/src/runtime/iface.c:501
88 ifaceeq(0x2aa7c0, 0x0, 0x0, 0x0, 0x2aa7c0, ...)
89 sys·ifaceeq+0x48 /Users/rsc/goX/src/runtime/iface.c:527
90 sys·ifaceeq(0x2aa7c0, 0x0, 0x0, 0x0, 0x2aa7c0, ...)
91 main·main+0x190 /Users/rsc/goX/src/cmd/gc/x.go:10
93 mainstart+0xf /Users/rsc/goX/src/runtime/amd64/asm.s:53
95 sys·Goexit /Users/rsc/goX/src/runtime/proc.c:124