Source file test/fixedbugs/issue28079a.go

     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  
     9  package p
    10  
    11  import "unsafe"
    12  
    13  func f() {
    14  	var x [0]int
    15  	x[uintptr(unsafe.Pointer(nil))] = 0
    16  }
    17  func g() {
    18  	var x [10]int
    19  	_ = x[3:uintptr(unsafe.Pointer(nil))]
    20  }
    21  

View as plain text