3
// Copyright 2013 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
// Issue 4585: comparisons and hashes process blank
8
// fields and padding in structs.
14
// T is a structure with padding.
23
// U is a structure with a blank field
29
// USmall is like U but the frontend will inline comparison
30
// instead of calling the generated eq function.
35
// V has padding but not on the first field.
42
// W has padding at the end.
52
copy((*[16]byte)(unsafe.Pointer(&a))[:], "hello world!")
56
panic("broken equality: a != b")
62
panic("broken hash: len(m) == 2")
73
copy((*[16]byte)(unsafe.Pointer(&a))[:], "hello world!")
74
a.A, a.B, a.C, a.D = 1, 2, 3, 4
75
b.A, b.B, b.C, b.D = 1, 2, 3, 4
78
panic("broken equality: a != b")
84
panic("broken hash: len(m) == 2")
93
copy((*[12]byte)(unsafe.Pointer(&a))[:], "hello world!")
97
panic("broken equality: a != b")
105
copy((*[20]byte)(unsafe.Pointer(&a))[:], "Hello World, Gopher!")
106
a.A1, a.A2, a.A3, a.B, a.C = 1, 2, 3, 4, 5
107
b.A1, b.A2, b.A3, b.B, b.C = 1, 2, 3, 4, 5
110
panic("broken equality: a != b")
116
panic("broken hash: len(m) == 2")
127
copy((*[20]byte)(unsafe.Pointer(&a))[:], "Hello World, Gopher!")
128
a.A1, a.A2, a.A3, a.B, a.C = 1, 2, 3, 4, 5
129
b.A1, b.A2, b.A3, b.B, b.C = 1, 2, 3, 4, 5
132
panic("broken equality: a != b")
138
panic("broken hash: len(m) == 2")