Bug 23004 – importC: calling function pointer named 'init' or 'stringof' from struct or union pointer gives error
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-10T09:26:14Z
Last change time
2022-04-18T13:35:55Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
duser
Comments
Comment #0 by duser — 2022-04-10T09:26:14Z
struct { void(*init)(); void(*stringof)(); } *sp;
union { void(*init)(); void(*stringof)(); } *up;
void fn()
{
sp->init();
sp->stringof();
up->init();
up->stringof();
}
test.c(5): Error: function expected before `()`, not `null` of type `__tag2*`
test.c(6): Error: function expected before `()`, not `"sp"` of type `char*`
test.c(7): Error: function expected before `()`, not `null` of type `__tag3*`
test.c(8): Error: function expected before `()`, not `"up"` of type `char*`
Comment #1 by dlang-bot — 2022-04-18T06:27:28Z
@WalterBright created dlang/dmd pull request #14006 "fix Issue 23004 - importC: calling function pointer named 'init' or '…" fixing this issue:
- fix Issue 23004 - importC: calling function pointer named 'init' or 'stringof' from struct or union pointer gives error
https://github.com/dlang/dmd/pull/14006
Comment #2 by dlang-bot — 2022-04-18T13:35:55Z
dlang/dmd pull request #14006 "fix Issue 23004 - importC: calling function pointer named 'init' or '…" was merged into master:
- a2ae2a637bba26d1103fdd563e21d135d9547694 by Walter Bright:
fix Issue 23004 - importC: calling function pointer named 'init' or 'stringof' from struct or union pointer gives error
https://github.com/dlang/dmd/pull/14006