Source file src/simd/testdata/mains/errors.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 NOT compile, because
    10  // it uses the unsafe.Sizeof of a "simd" type in a constant
    11  // context (as an array size).
    12  
    13  import (
    14  	"simd"
    15  	"unsafe"
    16  )
    17  
    18  var v [1]simd.Int8s
    19  var u [unsafe.Sizeof(v)]byte
    20  
    21  func main() {
    22  	if len(u) != 16 {
    23  		println("FAIL")
    24  	}
    25  }
    26  

View as plain text