Open
Description
cgo
fails to reject the following program — despite numerous errors involving values of type C.void
, which ought to be completely uninstantiable. (The word “void” itself means “empty”, so it's nonsensical for the type “void” to contain a value!)
I'm not sure to what extent this is fixable, given that the fix for #3729 added a test verifying that Go callers can bind _, err
to the result of a call to a void-returning function.
package p
/*
static void return_void() { return; }
*/
import "C"
func F() {
x := C.return_void() // ERROR HERE
var y C.void = x // ERROR HERE
var z *C.void = &y // ERROR HERE
var b [0]byte = *z // ERROR HERE
_ = b
}