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

          Issue ID: 17660
           Summary: ICE with `static foreach`:
                    AssertError@ddmd/visitor.d(39)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: ag0ae...@gmail.com

test.d:
----
template AliasSeq(stuff ...) { alias AliasSeq = stuff; }

auto append()
{
    static foreach (i; AliasSeq!(1)) {}
    int result;
    return result;
}
----

`dmd -c test.d`:
----
core.exception.AssertError@ddmd/visitor.d(39): Assertion failure
----------------
??:? _d_assertp [0x8098cf09]
??:? _ZN7Visitor5visitEP9Statement [0x8089b5f8]
??:? _ZN7Visitor5visitEP19ForwardingStatement [0x8089b679]
??:? _ZN19ForwardingStatement6acceptEP7Visitor [0x808930a9]
??:? _ZN22StatementRewriteWalker9visitStmtERP9Statement [0x8089ce43]
??:? _ZN22StatementRewriteWalker5visitEP17CompoundStatement [0x8089cf05]
??:? _ZN17CompoundStatement6acceptEP7Visitor [0x80892935]
??:? _ZN22StatementRewriteWalker9visitStmtERP9Statement [0x8089ce43]
??:? _ZN15FuncDeclaration9semantic3EP5Scope [0x8082e14c]
??:? _ZN6Module9semantic3EP5Scope [0x807d5995]
??:? int ddmd.mars.tryMain(ulong, const(char)**) [0x8085755e]
??:? _Dmain [0x8085857a]
----

Works without `static`. Also fails with `static foreach (i; 0 .. 1) {}`.

Tested with DMD64 D Compiler v2.075.0-rc1-190-ge3705e3d9.

--

Reply via email to