Thanks Ian. I have submitted issue 28069 along with the simplest example I could figure out. I found that the behaviour is triggered when a long double is nested in an inner field of a struct; moving the long double to the outer field of the struct lets the go build complete successfully.
Regards Bruce On Monday, 8 October 2018 13:26:16 UTC+11, Bruce Smith wrote: > > The header file smi.h from libsmi (https://github.com/mikeowens/libsmi) > declares a typedef using "long double" > > typedef long double SmiFloat128; > > In Go versions prior to 1.11, programs using smi.h compiled without error. > In Go 1.11, cgo calls out "long double" as "unexpected". Here is that > changed behaviour: > > bruce@calochilus:/tmp$ go version > go version go1.11 linux/amd64 > bruce@calochilus:/tmp$ go build longdouble.go > # command-line-arguments > -: unexpected: 16-byte float type - long double > bruce@calochilus:/tmp$ go1.10/bin/go version > go version go1.10.3 linux/amd64 > bruce@calochilus:/tmp$ go1.10/bin/go build longdouble.go > bruce@calochilus:/tmp$ cat longdouble.go > package main > > /* > #cgo LDFLAGS: -lsmi > #include <stdlib.h> > #include <smi.h> > */ > import "C" > > import ( > "fmt" > ) > > type SmiType struct { > smiType *C.struct_SmiType > } > > func main() { > fmt.Println("Hello") > } > bruce@calochilus:/tmp$ > > So this raises two questions for me: > > a) is it a bug that the error message does not include a line number (the > code in cmd/cgo/gcc.go tries to print a line number) > b) what is a 'best practice' approach to handling such an incompatible > C-type? > > Regards > Bruce > > -- 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.