www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21955] New: CastExp of noreturn is detected too late

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

          Issue ID: 21955
           Summary: CastExp of noreturn is detected too late
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

this code is rejected with an error in the backend, it should be a front-end
error instead.

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

int main()
{
    noreturn a;
    auto c = cast(int) a;
    return 0;
} 
---

 /tmp/temp_7F9C4DB5BA30.d:8:24: Error: e2ir: cannot cast `a` of type `noreturn`
to type `int`
DMD git 9d718f2f8c7f34d3b616791493d9e71d7527f221 --
May 22 2021