digitalmars.D.bugs - [Issue 22004] New: [REG2.097] Error: mismatched function return type
- d-bugmail puremagic.com (28/28) Jun 08 2021 https://issues.dlang.org/show_bug.cgi?id=22004
https://issues.dlang.org/show_bug.cgi?id=22004 Issue ID: 22004 Summary: [REG2.097] Error: mismatched function return type inference of `void` and `noreturn` Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: rejects-valid Severity: regression Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dlang-bugzilla thecybershadow.net /////////////////////////// test.d /////////////////////////// alias fun = _ => {}(); alias gun = _ => assert(0); auto bun(bool b) { if (b) return gun(0); else return fun(0); } ////////////////////////////////////////////////////////////// test.d(3): Error: mismatched function return type inference of `void` and `noreturn` The return type of bun should be void, as in fun's. If the gun and fun calls are swapped, the error message changes: test.d(3): Error: cannot return non-void from `void` function But, "returning" a "noreturn" value should be allowed from a void function. Worked in 2.096.0. --
Jun 08 2021