Source file
test/fixedbugs/issue30606b.go
1
2
3
4
5
6
7 package main
8
9 import "reflect"
10
11 func main() {}
12
13 func typ(x interface{}) reflect.Type { return reflect.ValueOf(x).Type() }
14
15 var byteType = typ((byte)(0))
16 var ptrType = typ((*byte)(nil))
17
18
19
20
21 var smallPtrType = reflect.ArrayOf(100, ptrType)
22 var mediumPtrType = reflect.ArrayOf(1000, ptrType)
23 var bigPtrType = reflect.ArrayOf(16385, ptrType)
24
25 var x0 = reflect.New(reflect.StructOf([]reflect.StructField{
26 {Name: "F1", Type: byteType},
27 {Name: "F2", Type: bigPtrType},
28 }))
29 var x1 = reflect.New(reflect.StructOf([]reflect.StructField{
30 {Name: "F1", Type: smallPtrType},
31 {Name: "F2", Type: bigPtrType},
32 }))
33 var x2 = reflect.New(reflect.StructOf([]reflect.StructField{
34 {Name: "F1", Type: mediumPtrType},
35 {Name: "F2", Type: bigPtrType},
36 }))
37 var x3 = reflect.New(reflect.StructOf([]reflect.StructField{
38 {Name: "F1", Type: ptrType},
39 {Name: "F2", Type: byteType},
40 {Name: "F3", Type: bigPtrType},
41 }))
42 var x4 = reflect.New(reflect.StructOf([]reflect.StructField{
43 {Name: "F1", Type: ptrType},
44 {Name: "F2", Type: smallPtrType},
45 {Name: "F3", Type: bigPtrType},
46 }))
47 var x5 = reflect.New(reflect.StructOf([]reflect.StructField{
48 {Name: "F1", Type: ptrType},
49 {Name: "F2", Type: mediumPtrType},
50 {Name: "F3", Type: bigPtrType},
51 }))
52
View as plain text