digitalmars.D.bugs - [Issue 19210] New: Poor error message for `return` function
- d-bugmail puremagic.com (36/36) Aug 31 2018 https://issues.dlang.org/show_bug.cgi?id=19210
https://issues.dlang.org/show_bug.cgi?id=19210 Issue ID: 19210 Summary: Poor error message for `return` function parameter that is not `ref` Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: slavo5150 yahoo.com safe: ref int identity(return ref int x) { return x; } ref int fun(return int x) { return identity(x); //Error: returning identity(x) escapes a reference to parameter x, perhaps annotate with return } void main() { int i; int j = fun(i); } $ dmd -dip25 main.d https://run.dlang.io/is/lvvRUR The problem is that `x`, in function `fun` is already annotated with `return`, so the error message doesn't make sense. I believe there should be an error message emitted disallowing `return` on parameters that are not `ref` or `out`, but I'm not sure --
Aug 31 2018