[Issue 24375] New: ImportC: .di generator outputs C expression with `->` operator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 8 20:34:15 UTC 2024


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

          Issue ID: 24375
           Summary: ImportC: .di generator outputs C expression with `->`
                    operator
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dave287091 at gmail.com

C code:

struct foo {
    int x;
};
typedef int weird[sizeof(((struct foo *)((void*)0))->x)];

outputs:

extern(C)
{
  // ...
        struct foo
        {
                int x = void;
        }
        alias weird = int[(cast(foo*)cast(void*)0)->x.sizeof];
  // ...
}

Encountered something like this in an SDL header.

--


More information about the Digitalmars-d-bugs mailing list