static foreach over constant range in @nogc block
tspike
email at gamedevgp.net
Sat Oct 3 11:18:59 UTC 2020
I came across an issue recently that I’m a little confused by.
The following program fails to compile under LDC and DMD, though
it compiles fine under GDC:
@nogc:
void main()
{
static foreach(i; 0 .. 4)
{
pragma(msg, i);
}
}
Both DMD and LDC report the following error if I try to compile
it:
test.d(7): Error: cannot use operator ~= in @nogc delegate
test.main.__lambda1
I was just wondering, is this is a compiler bug or is there a
reason I'm overlooking preventing this sort of code from
compiling?
More information about the Digitalmars-d-learn
mailing list