[Issue 21927] New: ICE (illegal instruction) with static foreach over empty member template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 18 10:36:17 UTC 2021


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

          Issue ID: 21927
           Summary: ICE (illegal instruction) with static foreach over
                    empty member template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

//////////////// test.d ///////////////
struct S
{
    template tpl()
    {
    }

    void fun()
    {
        static foreach (p; this.tpl!())
        {
        }
    }
}
///////////////////////////////////////

Compilation fails with:

be = '.' this.tpl!() at [test.d(9)]
[1]    3724069 illegal hardware instruction (core dumped)  dmd -o- test.d

For whatever reason, the "this." is important.

--


More information about the Digitalmars-d-bugs mailing list