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

          Issue ID: 23587
           Summary: cast(void) doesn't work for noreturn
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: ar...@samerion.com

```
noreturn stuff() {
    assert(false);
}

void doStuff(alias fun)() {

    // This is a template, so I don't want to have to care about noreturn
    cast(void) fun();
    writeln("never written");

    // Should output "void"
    pragma(msg, typeof(cast(void) fun()));

}

void main() {
    doStuff!stuff();
}
```

Starting with DMD 2.101, the pragma in the above example outputs "noreturn"
rather than the expected "void" and issues "Warning: statement is not
reachable".

--

Reply via email to