On Sat, Sep 20, 2014 at 3:04 AM, Anthony Green <gr...@moxielogic.com> wrote: > >> Attached patch fixes libgo reflect test failure with libffi closures. >> The gccgo compiler started to use FFI closures recently; the compiler >> passes ffi_type_void for structures with zero members. > > Why not just pass an FFI_TYPE_STRUCT with zero members?
Because when an empty struct is used as a return type libffi returns a failure from ffi_prep_cif_core: /* Initialize the return type if necessary */ if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; This is because initialize_aggregate fails: if (UNLIKELY(arg == NULL || arg->elements == NULL)) return FFI_BAD_TYPEDEF; I haven't looked farther. Ian