Reveals while porting old C library, below code crashes dmd v2.062 without any error reported:
long gi;
enum gi0 = ((cast(int *)&gi)[0]);
enum gi1 = ((cast(int *)&gi)[1]);
void main()
{
}
Comment #1 by NCrashed — 2013-03-13T13:05:45Z
Appears only at Windows.
Comment #2 by bearophile_hugs — 2013-03-13T13:08:00Z
If you port C code them maybe you want to write:
__gshared long gi;
Comment #3 by NCrashed — 2013-03-14T07:08:09Z
(In reply to comment #2)
> If you port C code them maybe you want to write:
>
>
> __gshared long gi;
It is doesn't matter, this code doesn't have sence in D, enums are calculated in compile time, but preprocessor just pastes code in C.
When porting C code, it is very difficult to find such error due dmd just crashes without any message.