This is already noted as a limitation of ImportC (the mismatch in keywords) and in D code you can work around it using __traits. However, in the .di generator you instead get a parse error:
C code:
struct foo {
int version;
const char* function;
int uint;
};
.di file:
// ...
struct foo
{
int version = void;
const(char)* function = void;
int uint = void;
}
// ...
Trying to import the .di file will then fail.
I think ideally you solve this with adding a mechanism for D identifiers to have the same name as keywords. A new kind of string?
Another way to go is to have the compiler rename identifiers that are D keywords when importing C code (say by appending an underscore). Could also only do that in the .di generation, but then importing the C code and importing the .di file are different.
Comment #1 by robert.schadek — 2024-12-13T19:33:07Z