[Issue 22926] importC: cast to D type alias in array length gives syntax error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 25 15:25:43 UTC 2022


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

duser at neet.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|importC: can't use offsetof |importC: cast to D type
                   |in array length             |alias in array length gives
                   |                            |syntax error

--- Comment #1 from duser at neet.fi ---
looked at this some more, the syntax error seems related to using a D type for
the cast - size_t is implicitly imported from object.d in the example so it's
not really a valid C program

the error in v2.099.0 was already fixed by
https://github.com/dlang/dmd/pull/13736 but the cast with D types became a
syntax error with https://github.com/dlang/dmd/pull/13831

here's a better example than the first one:

// test.c(2): Error: found `1` when expecting `]`
// test.c(2): Error: `=`, `;` or `,` expected to end declaration instead of `]`
__import core.stdc.stdint;
char cs[(int32_t)1];

--


More information about the Digitalmars-d-bugs mailing list