The following code causes DMD (2.111.0) to crash with message "terminated by signal SIGSEGV (Address boundary error)", while LDC (1.41.0) and GDC (14.2.0) compile it (tried on Debian 13.2, x86_64):
void main()
{
enum var;
import std.stdio : File;
@var File file = File("tmp", "w");
}
The workaround I found is to separate the assignment from the declaration; then DMD compiles the code:
void main()
{
enum var;
import std.stdio : File;
@var File file;
file = File("tmp", "w");
}
I have found no problem applying UDAs to variables of other types.