www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21956] New: ice on foreach over an AA of noreturn

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

          Issue ID: 21956
           Summary: ice on foreach over an AA of noreturn
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

this code triggers an assertion in the backend:

---
alias noreturn = typeof(*null);

noreturn[noreturn] nrnr;

int main()
{
    foreach (a; nrnr){}
    return 0;
}  
---

 dmd: src/dmd/backend/cod4.d:416: Assertion `cast(int)sz > 0' failed.
DMD git 9d718f2f8c7f34d3b616791493d9e71d7527f221 --
May 22 2021