Source file src/simd/testdata/compiles_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 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 "testing" 17 "unsafe" 18 ) 19 20 var v_for_sizeof [1]simd.HasConstantSize24 21 var u [unsafe.Sizeof(v_for_sizeof)]byte 22 23 func TestCompiles(t *testing.T) { 24 25 if len(u) != 24 { 26 t.Errorf("len(u) is %d, instead of expected 24", len(u)) 27 } 28 } 29