www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17845] New: [ICE] backend\cgcod.c 1677 static foreach

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

          Issue ID: 17845
           Summary: [ICE] backend\cgcod.c 1677 static foreach
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: mrsmith33 yandex.ru

---
void main()
{
    struct Row
    {
         Column!Row((ref Row r, scope SinkT s){ s("test"); })
        uint fileSize;
    }
    auto formatters = parseRowInfo!Row;
}


alias SinkT = void delegate(const(char)[]);
alias Formatter(Row) = void delegate(ref Row row, scope SinkT sink);

struct Column(Row)
{
    Formatter!Row formatter;
}

Formatter!Row[] parseRowInfo(Row)()
{
    import std.traits;
    Formatter!Row[] formatters;
    static foreach(member; getSymbolsByUDA!(Row, Column!Row))
    {
        formatters ~= getUDAs!(member, Column!Row)[0].formatter;
    }
    return formatters;
}

---

This is reduced case. I was trying to make this work without static in foreach,
but adding static crashed the compiler.

Win10 DMD 2.076

Doesn't crash on dpaste though.

--
Sep 21 2017