summaryrefslogtreecommitdiff
path: root/misc/cgo/test/issue8428.go
blob: a3dc5755ce41dfeffbadfd1af7e2e00dd57772bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2014 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This test fails on older versions of OS X because they use older buggy
// versions of Clang that emit ambiguous DWARF info.  See issue 8611.
// +build !darwin

package cgotest

// Issue 8428.  Cgo inconsistently translated zero size arrays.

/*
struct issue8428one {
	char b;
	char rest[];
};

struct issue8428two {
	void *p;
	char b;
	char rest[0];
};

struct issue8428three {
	char w[1][2][3][0];
	char x[2][3][0][1];
	char y[3][0][1][2];
	char z[0][1][2][3];
};
*/
import "C"

import "unsafe"

var _ = C.struct_issue8428one{
	b:    C.char(0),
	rest: [0]C.char{},
}

var _ = C.struct_issue8428two{
	p:    unsafe.Pointer(nil),
	b:    C.char(0),
	rest: [0]C.char{},
}

var _ = C.struct_issue8428three{
	w: [1][2][3][0]C.char{},
	x: [2][3][0][1]C.char{},
	y: [3][0][1][2]C.char{},
	z: [0][1][2][3]C.char{},
}