Source file src/simd/testdata/errors_test.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 testdata_test 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 "testing" 16 "unsafe" 17 ) 18 19 var v_from_simd [1]simd.Int8s 20 21 func TestItDoesNotCompile(t *testing.T) { 22 var u [unsafe.Sizeof(v_from_simd)]byte 23 if len(u) != 16 { 24 println("FAIL") 25 } 26 } 27