https://issues.dlang.org/show_bug.cgi?id=23391

          Issue ID: 23391
           Summary: Segmentation fault.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

The following code (reduced by Mayonix on discord) causes the compiler to
crash:
```d
struct MyTuple {
    string s;
}

inout(string) myfront(inout(string)[] a)
{
    return a[0];
}

MyTuple[] myarray(MyZip r)
{
    MyTuple[] result;
    foreach (e; r)
        result ~= e;
    return result;
}

struct MyZip
{
    bool empty = false;
    MyTuple front()
    {
        return MyTuple([""].myfront);
    }
    void popFront()
    {
        empty = true;
    }
}

static foreach(t; MyZip().myarray) {}
```

--

Reply via email to