Sure, it's a problem, a bug in GHC, whatever. But I don't see a way around it! We can't just generate prototypes because they might conflict with prototypes already in scope.
I see the problem now.
This seems to compile (with a warning):
typedef long long HsInt64;
int foo (int); // annoying decl we want to ignore
// foo :: Int64 -> IO Int64 inline HsInt64 call_foo (HsInt64 x) { static HsInt64 foo(HsInt64); return foo(x); };
I haven't actually tested it, but it may be a solution.
Strange; gcc doesn't generate an error for the local prototype for foo(), although it does if you remove the 'static'. My copy of the C99 standard has this to say: [#7] If, within a translation unit, the same identifier appears with both internal and external linkage, the behavior is undefined. and 20)A function declaration can contain the storage-class specifier static only if it is at file scope; see 6.7.1. which I think means that you shouldn't do this. GCC seems to be not complying with C99 here. Cheers, Simon