1
0
mirror of https://github.com/golang/go synced 2024-11-15 03:40:29 -07:00
go/test/fixedbugs/issue30606.go
Keith Randall 05b3db24c1 reflect: fix StructOf GC programs
They are missing a stop byte at the end.

Normally this doesn't matter, but when including a GC program
in another GC program, we strip the last byte. If that last byte
wasn't a stop byte, then we've thrown away part of the program
we actually need.

Fixes #30606

Change-Id: Ie9604beeb84f7f9442e77d31fe64c374ca132cce
Reviewed-on: https://go-review.googlesource.com/c/go/+/165857
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 20:22:14 +00:00

21 lines
502 B
Go

// run
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import "reflect"
func main() {}
func typ(x interface{}) reflect.Type { return reflect.ValueOf(x).Type() }
var x = reflect.New(reflect.StructOf([]reflect.StructField{
{Name: "F5", Type: reflect.StructOf([]reflect.StructField{
{Name: "F4", Type: reflect.ArrayOf(5462,
reflect.SliceOf(typ(uint64(0))))},
})},
}))