[Issue 23587] New: cast(void) doesn't work for noreturn
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 28 13:15:15 UTC 2022
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: nobody at puremagic.com
Reporter: artha at 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".
--
More information about the Digitalmars-d-bugs
mailing list