1// compile 2 3// Copyright 2018 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. 6 7// Non-Go-constant but constant indexes are ok at compile time. 8 9package p 10 11import "unsafe" 12 13func f() { 14 var x [0]int 15 x[uintptr(unsafe.Pointer(nil))] = 0 16} 17func g() { 18 var x [10]int 19 _ = x[3:uintptr(unsafe.Pointer(nil))] 20} 21