Closed
Description
C struct definition:
typedef struct {
attr_t attr;
wchar_t chars[CCHARW_MAX];
} cchar_t;
.c2hs file contains:
let cAttrs = undefined :: CInt
let cChars = undefined :: CWString
{# set cchar_t->attr #} (CCharT pBuf) cAttrs
{# set cchar_t->chars #} (CCharT pBuf) cChars
c2hs 0.20.1 and earlier generate:
(\(CCharT ptr) val -> do {pokeByteOff ptr 0 (val::CUInt)}) (CCharT pBuf) cAttrs
(\(CCharT ptr) val -> do {pokeByteOff ptr 4 (val::(CWString))}) (CCharT pBuf) cChars
c2hs 0.21.1 and later generate:
(\(CCharT ptr) val -> do {pokeByteOff ptr 0 (val::CUInt)}) (CCharT pBuf) cAttrs
(\(CCharT ptr) val -> do {poke ptr (val::(CWString))}) (CCharT pBuf) cChars
This new generated code won't typecheck; poke
is Ptr a -> a -> IO ()
, so poke ptr
is of type CCharT -> IO ()
which obviously won't accept a CWString
.
I believe this was caused by 5698388
Metadata
Metadata
Assignees
Labels
No labels