[Issue 22004] [REG2.097] Error: mismatched function return type inference of `void` and `noreturn`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 11 00:36:00 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22004
Dlang Bot <dlang-bot at dlang.rocks> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |pull
--- Comment #6 from Dlang Bot <dlang-bot at dlang.rocks> ---
@MoonlightSentinel created dlang/dmd pull request #13155 "Fix 22004 -
Subsequent return statements override inferred noreturn return type" fixing
this issue:
- Fix 22004 - Subsequent return statements override inferred noreturn...
... return type.
Return type inference used to commit to `noreturn` when encountering
a return statement producing a `noreturn` value. This was problematic
when the function contained subsequent `void` returns, raising an error
regarding missmatched function type inference even though `void` and
`noreturn` are compatible (neither produce an actual value).
This patch changes the code to let `noreturn` be overriden by `void`.
https://github.com/dlang/dmd/pull/13155
--
More information about the Digitalmars-d-bugs
mailing list