[Issue 23591] New: [REG 2.101] Invalid casts accepted by the compiler if from type is noreturn

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 30 12:47:24 UTC 2022


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

          Issue ID: 23591
           Summary: [REG 2.101] Invalid casts accepted by the compiler if
                    from type is noreturn
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

This nonsense is compilable.
---
noreturn square(int x);

int example(int i)
{
    int x = cast(string)square(i);
    int y = cast(real function(char))assert(0);
    return x + y;
}
---

Introduced by https://github.com/dlang/dmd/pull/14494

--


More information about the Digitalmars-d-bugs mailing list