[Issue 23587] cast(void) doesn't work for noreturn

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 30 23:37:31 UTC 2022


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

--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to artha from comment #5)
> (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.
> 

You're not wrong. cast(void) bottom is completely valid and the result should
be void.

--


More information about the Digitalmars-d-bugs mailing list