Op donderdag 23 maart 2017 20:58:53 UTC+1 schreef Ian Lance Taylor: > > On Thu, Mar 23, 2017 at 11:56 AM, Peter Kleiweg <pkle...@xs4all.nl > <javascript:>> wrote: > > Op donderdag 23 maart 2017 17:46:18 UTC+1 schreef Ian Lance Taylor: > >> > >> On Thu, Mar 23, 2017 at 8:54 AM, Peter Kleiweg <pkle...@xs4all.nl> > wrote: > >> > Some code that includes C code compiles fine on Linux, but gives > strange > >> > errors on Darwin. > >> > > >> > > >> > In one source file, that doesn't include C, I have this: > >> > > >> > type reactor_socket struct { > >> > e State > >> > f func(State) error > >> > } > >> > > >> > and... > >> > > >> > reactor_socket{e: events, f: handler} > >> > > >> > > >> > > >> > In another file that does include C, I have this: > >> > > >> > type State int > >> > > >> > > >> > > >> > Compiling of the first source file gives these errors on the line > >> > creating > >> > the reactor_socket: > >> > > >> > workspace/go/src/github.com/pebbe/zmq4/reactor.go:57: cannot use > >> > events > >> > (type State) as type int in field value > >> > workspace/go/src/github.com/pebbe/zmq4/reactor.go:57: cannot use > >> > handler > >> > (type func(State) error) as type func(int) error in field value > >> > > >> > It looks like in one source file, the type State is preserved, while > in > >> > the > >> > other it is replaced by an int. > >> > > >> > > >> > Is this a compiler bug? What else could it be? > >> > > >> > Please see details at https://github.com/pebbe/zmq4/issues/97 > >> > >> I suppose it could be a cgo bug. I can't recreate it, but I'm using > >> GNU/Linux. I tried both GCC and clang. > >> > >> Try running `go build -work` to preserve the temporary directory and > >> look at the generated .go files. > > > > > > There is no generated Go file corresponding to the file that generates > the > > error. > > No, I wouldn't expect one, but it seems that the contents of the files > that are generated must be triggering the error somehow. In > particular it might be interesting to compare the generated files on a > working system with the ones on a failing system. >
OK, here are all the differences: https://pkleiweg.home.xs4all.nl/go/diff.txt -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.