mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
![Than McIntosh](/assets/img/avatar_default.png)
The function runtime.convT64 accepts a single uint64 argument, but the compiler's rules in the walk phase for determining whether is it ok to pass a value of type T to a call to runtime.convT64 were slightly off. In particular the test was allowing a type T with size less than eight bytes but with more than one internal element (e.g. a struct). This patch tightens up the rules somewhat to prevent this from happening. Updates #40724. Change-Id: I3b909267534db59429b0aa73a3d73333e1bd6432 Reviewed-on: https://go-review.googlesource.com/c/go/+/308069 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
26 lines
387 B
Go
26 lines
387 B
Go
// run
|
|
|
|
// Copyright 2021 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 (
|
|
"fmt"
|
|
)
|
|
|
|
type MyStruct struct {
|
|
F0 [0]float64
|
|
F1 byte
|
|
F2 int16
|
|
_ struct {
|
|
F0 uint32
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
p0 := MyStruct{F0: [0]float64{}, F1: byte(27), F2: int16(9887)}
|
|
fmt.Println(p0)
|
|
}
|