[Issue 22884] ImportC: error when casting between function pointers for statically initialized variables
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 17 07:43:54 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22884
--- Comment #2 from dave287091 at gmail.com ---
(In reply to dave287091 from comment #1)
> (In reply to dave287091 from comment #0)
> > The following C code fails to compile. This kind of pointer cast can be seen
> > [...]
Also, it looks like this function does error, compilation was just not reaching
that point due to the previous error.
typedef void (*funcptr)(void);
funcptr foo(void){
funcptr f = (funcptr)printf; // Error: e2ir: cannot cast `printf` of type
`extern (C) int(const(char)*, ...)` to type `extern (C) void function()
return f;
}
Probably same problem, it’s not decaying to a function pointer when it should.
--
More information about the Digitalmars-d-bugs
mailing list