github.com/razvanm/vanadium-go-1.3@v0.0.0-20160721203343-4a65068e5915/misc/cgo/test/issue8428.go (about) 1 // Copyright 2014 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 // This test fails on older versions of OS X because they use older buggy 6 // versions of Clang that emit ambiguous DWARF info. See issue 8611. 7 // +build !darwin 8 9 package cgotest 10 11 // Issue 8428. Cgo inconsistently translated zero size arrays. 12 13 /* 14 struct issue8428one { 15 char b; 16 char rest[]; 17 }; 18 19 struct issue8428two { 20 void *p; 21 char b; 22 char rest[0]; 23 }; 24 25 struct issue8428three { 26 char w[1][2][3][0]; 27 char x[2][3][0][1]; 28 char y[3][0][1][2]; 29 char z[0][1][2][3]; 30 }; 31 */ 32 import "C" 33 34 import "unsafe" 35 36 var _ = C.struct_issue8428one{ 37 b: C.char(0), 38 rest: [0]C.char{}, 39 } 40 41 var _ = C.struct_issue8428two{ 42 p: unsafe.Pointer(nil), 43 b: C.char(0), 44 rest: [0]C.char{}, 45 } 46 47 var _ = C.struct_issue8428three{ 48 w: [1][2][3][0]C.char{}, 49 x: [2][3][0][1]C.char{}, 50 y: [3][0][1][2]C.char{}, 51 z: [0][1][2][3]C.char{}, 52 }