D-Scanner icon indicating copy to clipboard operation
D-Scanner copied to clipboard

Report of unused_variable_check is incorrect

Open shoo opened this issue 5 years ago • 0 comments

This code should not warn Variable a is never used.

@safe unittest {
	int a;
	static assert(is(typeof(a)));
}

Workaround:

@safe unittest
{
	miixn(q{ int a; });
	static assert(is(typeof(a)));
}

But it is not desirable to use this method too much, as it silences everything. And the burden on the compiler due to the string mixin is also a concern.

shoo avatar Aug 02 '20 14:08 shoo