Comments

What steps will reproduce the problem?
I have some code I want to build in C++ mode but with extern "C" linkage.
However, using -x c++ with gcc breaks some of my other code.
After a make nuke, I build with:
CGO_CFLAGS=-x c++
and then I get:
cmsg.go: In function 'void _cgo_1a2aead0dab6_Cfunc_CMSG_DATA_(void*)':
cmsg.go:32:9: error: invalid conversion from 'void*' to
'_cgo_1a2aead0dab6_Cfunc_CMSG_DATA_(void*)::<anonymous struct>*' [-fpermissive]
cmsg.go: In function 'void _cgo_1a2aead0dab6_Cfunc_CMSG_LEN_(void*)':
cmsg.go:42:9: error: invalid conversion from 'void*' to
'_cgo_1a2aead0dab6_Cfunc_CMSG_LEN_(void*)::<anonymous struct>*' [-fpermissive]
cmsg.go: In function 'void _cgo_1a2aead0dab6_Cfunc_CMSG_SPACE_(void*)':
cmsg.go:52:9: error: invalid conversion from 'void*' to
'_cgo_1a2aead0dab6_Cfunc_CMSG_SPACE_(void*)::<anonymous struct>*' [-fpermissive]
make: *** [cmsg.cgo2.o] Error 1
Then with a make nuke and:
CGO_CFLAGS=-x c++ -fpermissive
I get:
cmsg.go:54:13: call of non-function C.CMSG_SPACE_
cmsg.go:54:27: call of non-function C.size_t
cmsg.go:59:13: call of non-function C.CMSG_LEN_
cmsg.go:59:25: call of non-function C.size_t
cmsg.go:64:13: call of non-function C.cmsghdr_t
cmsg.go:65:32: call of non-function C.CMSG_DATA_
make: *** No rule to make target `_cgo_run', needed by `_cgo_flags'. Stop.
If I first build with
CGO_CFLAGS=-x c++
until I get an error and then rebuild with
CGO_CFLAGS=-x c++ -fpermissive
without doing a make nuke in between, it builds. Seems like the -fpermissive build
should just work.
Which compiler are you using (5g, 6g, 8g, gccgo)?
6g
Which operating system are you using?
linux
Which revision are you using? (hg identify)
tip
gcc (GCC) 4.6.0 20110120 (experimental)