dmd
dmd copied to clipboard
ImportC: `typedef` C tag struct causes ImportC to emit erroneous "forward declared" struct definition.
The following struct in C:
// bug.i
typedef struct tagTIME_STRUCT
{
int hour;
int minute;
int second;
} TIME_STRUCT;
Produces the following output snippet in ImportC in file bug.d:
...
struct tagTIME_STRUCT
{
int hour = void;
int minute = void;
int second = void;
}
alias TIME_STRUCT = tagTIME_STRUCT;
struct tagTIME_STRUCT;
...
The second "forward declared" struct declaration should never be present and causes a build error in DMD.
Command to get error: $dmd bug.i -Hf=bug.d -verrors=0 -main, compiling the resultant file then fails with duplicate struct tagTIME_STRUCT
I can’t reproduce this bug.