[Issue 23587] cast(void) doesn't work for noreturn
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 30 16:43:08 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23587
--- Comment #5 from artha at samerion.com ---
(In reply to RazvanN from comment #3)
> Why does it matter? The call to fun will never return so casting to void (or
> any other value) it actually a no-op.
In this case it makes the compiler issue an unwanted warning. The cast is
supposed to tell the compiler I'm purposefully discarding the return value.
As a workaround, I could've done this:
```
fun();
static if (!is(typeof(stuff()) == void)) {
writeln("never written");
}
```
But it's a mess, and I don't want to do that every time I call a template
delegate.
--
More information about the Digitalmars-d-bugs
mailing list