1// Copyright 2015 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 5package race_test 6 7import "unsafe" 8 9// golang.org/issue/12225 10// The test is that this compiles at all. 11 12//go:noinline 13func convert(s string) []byte { 14 return []byte(s) 15} 16 17func issue12225() { 18 println(*(*int)(unsafe.Pointer(&convert("")[0]))) 19 println(*(*int)(unsafe.Pointer(&[]byte("")[0]))) 20} 21