Skip to content

Fix irrelevant dodgy-foreign-imports warning on import function pointers by value

A test сс018 is attached (not sure about the naming convention though). Note that without the fix, the test fails with the dodgy-foreign-imports warning passed to stderr. The warning disappears after the fix.

GHC shouldn't warn on imports of natural function pointers from C by value (which is feasible with CApiFFI), such as

foreign import capi "cc018.h value f" f :: FunPtr (Int -> IO ())

where

void (*f)(int);

See a related real-world use-case here. There, GHC warns on import of C function pointer pcre_free.

Merge request reports