Bug 23415 – ImportC: typedef'd struct as const parameter "is not callable"

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-10-14T22:33:51Z
Last change time
2023-02-03T15:45:06Z
Keywords
ImportC
Assigned to
No Owner
Creator
Ali Cehreli
See also
https://issues.dlang.org/show_bug.cgi?id=23662

Comments

Comment #0 by acehreli — 2022-10-14T22:33:51Z
// c.c typedef struct /* S_ */ { int i; } S; void foo(const S s) {} // d.d import c; void main() { S s; foo(s); } Error: function `c.foo(__tag46 s)` is not callable using argument types `(__tag45)` cannot pass argument `s` of type `__tag45` to parameter `__tag46 s` Same issue if the parameter is 'const S *'. The following are workarounds: a) Uncomment S_ in c.c b) Remove 'const' from the parameter
Comment #1 by razvan.nitu1305 — 2023-02-03T09:30:25Z
I cannot reproduce this.
Comment #2 by acehreli — 2023-02-03T15:45:06Z
Yes, works with 2.101.2.