[Issue 22004] [REG2.097] Error: mismatched function return type inference of `void` and `noreturn`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 10 23:13:22 UTC 2021


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

--- Comment #5 from Dlang Bot <dlang-bot at dlang.rocks> ---
dlang/dmd pull request #13149 "merge stable" was merged into master:

- 0fabd110dd146eaf868e1195e9bff172d3c9ba1c by Florian:
  Issue 22004 - Allow noreturn returns from void functions (#13135)

  This is valid because
  - `noreturn` is convertible to any type (incl. `void`)
  - the program will abort/throw while evaluating the expression and hence
    never actually return a value

  This means that the `ReturnStatement` can be replaced by the standalone
  expression without changing the behaviour of the program.

  ---

  Doesn't fix 22004 because the supplied example requires further changes
  to accomodate for `return <noreturn>;` and subsequent `return;`'s during
  the return type inference.

https://github.com/dlang/dmd/pull/13149

--


More information about the Digitalmars-d-bugs mailing list