mirror of
https://github.com/golang/go
synced 2024-11-22 22:30:02 -07:00
cmd/compile: allow unsafe.Pointer(nil) as static data
Fixes #16306 Change-Id: If8e2f411fe9a5a5c198f10765fee7261ba8feaf2 Reviewed-on: https://go-review.googlesource.com/24836 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
9d2b988e4a
commit
64214792e2
@ -1435,7 +1435,7 @@ func genAsInitNoCheck(n *Node, reportOnly bool) bool {
|
||||
|
||||
case TBOOL, TINT8, TUINT8, TINT16, TUINT16,
|
||||
TINT32, TUINT32, TINT64, TUINT64,
|
||||
TINT, TUINT, TUINTPTR,
|
||||
TINT, TUINT, TUINTPTR, TUNSAFEPTR,
|
||||
TPTR32, TPTR64,
|
||||
TFLOAT32, TFLOAT64:
|
||||
if !reportOnly {
|
||||
|
15
test/fixedbugs/issue16306.go
Normal file
15
test/fixedbugs/issue16306.go
Normal file
@ -0,0 +1,15 @@
|
||||
// compile
|
||||
|
||||
// Copyright 2016 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 "unsafe"
|
||||
|
||||
var x = unsafe.Pointer(uintptr(0))
|
||||
|
||||
func main() {
|
||||
_ = map[unsafe.Pointer]int{unsafe.Pointer(uintptr(0)): 0}
|
||||
}
|
Loading…
Reference in New Issue
Block a user