[Issue 22587] New: ternary with function call and assert(0) leads to cod1 assertion

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 12 03:54:53 UTC 2021


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

          Issue ID: 22587
           Summary: ternary with function call and assert(0) leads to cod1
                    assertion
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: backend
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxhaton at gmail.com

---
int front()
{
    return empty ? 1 : assert(0);
}

bool empty()
{
    return 0;
}
---

Yields: Assertion `retregs || !*pretregs' failed

Seems to crash LDC as well so maybe it's invalid code, that being said GDC
seems to do just fine.

--


More information about the Digitalmars-d-bugs mailing list