Bug 21993 – Cannot cast to noreturn

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-04T23:49:40Z
Last change time
2021-06-27T12:25:25Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel

Comments

Comment #0 by moonlightsentinel — 2021-06-04T23:49:40Z
`cast(noreturn) <exp>` is specified as `<exp>, assert(false)`. But DMD rejects the cast with `cannot cast ... to noreturn`
Comment #1 by dlang-bot — 2021-06-04T23:55:56Z
@MoonlightSentinel created dlang/dmd pull request #12633 "Fix 21993 - Implement cast(noreturn)" fixing this issue: - Fix 21993 - Implement cast(noreturn) Rewrite `cast(<qual> noreturn) <exp>` as `<exp>, assert(false)`. DIP: > Every type is allowed to be explicitly cast to noreturn. (Not to be > confused with noreturn implicitly casting to every type.) It generates > an assert(0): https://github.com/dlang/dmd/pull/12633
Comment #2 by dlang-bot — 2021-06-07T09:25:23Z
dlang/dmd pull request #12633 "Fix 21993 - Implement cast(noreturn)" was merged into stable: - 7bca3a660cdf02f2e9b983497c1442c6a269bc63 by MoonlightSentinel: Fix 21993 - Implement cast(noreturn) Rewrite `cast(<qual> noreturn) <exp>` as `<exp>, assert(false)`. DIP: > Every type is allowed to be explicitly cast to noreturn. (Not to be > confused with noreturn implicitly casting to every type.) It generates > an assert(0): https://github.com/dlang/dmd/pull/12633
Comment #3 by dlang-bot — 2021-06-27T12:25:25Z
dlang/dmd pull request #12768 "Merge stable into master" was merged into master: - 346de2d11de903bf95c7a6e573ef717110491e9c by MoonlightSentinel: Fix 21993 - Implement cast(noreturn) Rewrite `cast(<qual> noreturn) <exp>` as `<exp>, assert(false)`. DIP: > Every type is allowed to be explicitly cast to noreturn. (Not to be > confused with noreturn implicitly casting to every type.) It generates > an assert(0): https://github.com/dlang/dmd/pull/12768