digitalmars.D.bugs - [Issue 16226] New: -dip25 doesn't work if the return type is not
- via Digitalmars-d-bugs (57/57) Jul 01 2016 https://issues.dlang.org/show_bug.cgi?id=16226
https://issues.dlang.org/show_bug.cgi?id=16226 Issue ID: 16226 Summary: -dip25 doesn't work if the return type is not explicit Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: issues.dlang jmdavisProg.com This code results in an error with -dip25: void main() safe { int i; foo(i); } ref int foo(ref int bar) safe { return bar; } but this code void main() safe { int i; foo(i); } ref foo(ref int bar) safe { return bar; } and this code void main() safe { int i; foo(i); } ref auto foo(ref int bar) safe { return bar; } do not result in an error. Note that unless the return type actually includes int explictly rather than letting it be inferred, -dip25 is bypassed completely. Interestingly enough, it does catch this case though and error out correctly: void main() safe { foo(); } ref foo() safe { int bar = 42; return bar; } --
Jul 01 2016