www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23187] New: importC: __builtin_offsetof still doesn't work

https://issues.dlang.org/show_bug.cgi?id=23187

          Issue ID: 23187
           Summary: importC: __builtin_offsetof still doesn't work
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ryuukk.dev gmail.com

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); 
}

--
Jun 14 2022