[Issue 23189] importC: 0 pointer cast doesn't compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 15 20:55:04 UTC 2022


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

--- Comment #2 from ryuukk_ <ryuukk.dev at gmail.com> ---
Oops the code above is the actual fix..

Here the actual problematic code:

```
struct nk_table {
        void* test;
};


union nk_page_data {
    struct nk_table tbl;
};

void test(void)
{
    struct nk_table *tbl;
    union nk_page_data *pd = (union nk_page_data*)((void*)((char*)(1 ? (tbl):
&((union nk_page_data*)0)->tbl) - (__builtin_offsetof(k_page_data,tbl))));
}
```


__builtin_offsetof requires 'union', without it, i get the error:


```
bug.c(15): Error: expression expected, not `)`
bug.c(15): Error: found `0` when expecting `)`
```

--


More information about the Digitalmars-d-bugs mailing list