3 // Copyright 2018 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Test that string([]byte(string)) makes a copy and doesn't reduce to
8 // nothing. (Issue 25834)
19 buf = make([]byte, 2<<10)
22 subcopy = string([]byte(sub))
23 subh = *(*reflect.StringHeader)(unsafe.Pointer(&sub))
24 subcopyh = *(*reflect.StringHeader)(unsafe.Pointer(&subcopy))
26 if subh.Data == subcopyh.Data {
27 panic("sub and subcopy have the same underlying array")