Source file src/simd/testdata/mains/compiles.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build goexperiment.simd
     6  
     7  package main
     8  
     9  // For testing purposes, this SHOULD compile, because
    10  // the "simd" type whose unsafe.Sizeof is used in a
    11  // constant context, is from some other package whose
    12  // name (but not path) happens to be "simd".
    13  
    14  import (
    15  	"simd/testdata/simd"
    16  	"unsafe"
    17  )
    18  
    19  var v [1]simd.HasConstantSize24
    20  var u [unsafe.Sizeof(v)]byte
    21  
    22  func main() {
    23  	if len(u) != 24 {
    24  		println("FAIL")
    25  	}
    26  }
    27  

View as plain text