haskell / c2hs

c2hs is a pre-processor for Haskell FFI bindings to C libraries
http://hackage.haskell.org/package/c2hs
Other
199 stars 50 forks source link

`makeArg` pattern match failure #210

Open mitchellwrosen opened 6 years ago

mitchellwrosen commented 6 years ago

I've made a repository that possibly highlights a bug in c2hs:

https://github.com/mitchellwrosen/language-c-issue-54

To reproduce, run:

./build

(requires new-ish cabal-install, probably 2.0+).

On my machine, this produces:

Resolving dependencies...
Build profile: -w ghc-8.4.3 -O1
In order, the following will be built (use -v for more details):
 - foo-0 (lib:foo) (first run)
Configuring foo-0...
Preprocessing library for foo-0..
c2hs: Errors during generation of C wrappers:

./Foo.chs:9: (column 4) [ERROR]  >>> Internal wrapper error!
  Something went wrong generating a bare structure wrapper.
  makeArg:arg=False
  cdecl=CDecl [CTypeSpec (CTypeDef (Ident "WINDOW" 143904934 (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),6) (Name {nameId = 4053}))) (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),6) (Name {nameId = 4054})))] [(Just (CDeclr Nothing [CPtrDeclr [] (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),1) (Name {nameId = 4055}))] Nothing [] (OnlyPos <no file> (<no file>,-1))),Nothing,Nothing)] (NodeInfo ("./foo.h": line 1635) (("./foo.h": line 1635),1) (Name {nameId = 4056}))
  idx=1