summaryrefslogtreecommitdiffstats
path: root/llgo/test/execution/interfaces/comparei2i.go
diff options
context:
space:
mode:
Diffstat (limited to 'llgo/test/execution/interfaces/comparei2i.go')
-rw-r--r--llgo/test/execution/interfaces/comparei2i.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/llgo/test/execution/interfaces/comparei2i.go b/llgo/test/execution/interfaces/comparei2i.go
new file mode 100644
index 00000000000..5a1f2660e21
--- /dev/null
+++ b/llgo/test/execution/interfaces/comparei2i.go
@@ -0,0 +1,30 @@
+// RUN: llgo -o %t %s
+// RUN: %t 2>&1 | FileCheck %s
+
+// CHECK: true
+// CHECK-NEXT: true
+
+package main
+
+import "unsafe"
+
+type I interface {
+ X()
+}
+
+type T int
+
+func (t T) X() {
+}
+
+func main() {
+ var highbit uint32 = 1 << 31
+ var pos0 float32 = 0
+ var neg0 float32 = *(*float32)(unsafe.Pointer(&highbit))
+ var i1 interface{} = pos0
+ var i2 interface{} = neg0
+ println(i1 == i2)
+ var i3 interface{} = T(123)
+ var i4 I = T(123)
+ println(i3 == i4)
+}
OpenPOWER on IntegriCloud