Skip to content

Applying a UDA to a File-type variable causes DMD to crash #22282

@programandala-net

Description

@programandala-net

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions