https://issues.dlang.org/show_bug.cgi?id=20900
Issue ID: 20900
Summary: dmd crashes on static foreach over infinite range
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
A quick and easy way to trigger the OutOfMemoryError
struct SimpleRange
{
this(int front) { this.front = front; }
bool empty = false;
int front;
void popFront() { }
}
void main()
{
static foreach (x; SimpleRange(1)) { }
}
While it is somewhat obvious that it cannot work, the compiler tells me,
there's a bug in the compiler (
> ERROR: This is a compiler bug.
> Please report it via https://issues.dlang.org/enter_bug.cgi
). And in some way there is. The compiler cannot know that the range is
infinite, but it can just abort at some point.
--