Bug 23187 – importC: __builtin_offsetof still doesn't work
Status
RESOLVED
Resolution
INVALID
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-06-14T19:42:52Z
Last change time
2022-06-14T19:50:33Z
Keywords
ImportC
Assigned to
No Owner
Creator
ryuukk_
Comments
Comment #0 by ryuukk.dev — 2022-06-14T19:42:52Z
This was supposed to be fixed with PR: https://github.com/dlang/druntime/pull/3739
But it still doesn't work
bar.c(8): Error: undefined identifier `__builtin_offsetof`
--- test.d
import std.stdio;
import c = bar;
void main()
{
c.something s;
c.test(&s);
writeln(s);
}
--- bar.c
typedef struct
{
int offset;
} something;
void test(something* s)
{
s->offset = __builtin_offsetof(something, a);
}
Comment #1 by ryuukk.dev — 2022-06-14T19:50:33Z
Oops, i was using the wrong version of the compiller!