Bug 16226 – -dip25 doesn't work if the return type is not explicit

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-02T01:13:00Z
Last change time
2016-10-01T11:48:12Z
Keywords
safe
Assigned to
nobody
Creator
issues.dlang

Comments

Comment #0 by issues.dlang — 2016-07-02T01:13:08Z
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; }
Comment #1 by bugzilla — 2016-07-02T07:28:50Z
Comment #2 by github-bugzilla — 2016-07-04T02:08:38Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/0456f3f05909c510d2c2631c4364aaf2876c74ac fix Issue 16226 - -dip25 doesn't work if the return type is not explicit https://github.com/dlang/dmd/commit/d49c50e0300e810e907baaf2e42ef9b08be9d761 Merge pull request #5900 from WalterBright/fix16226 fix Issue 16226 - -dip25 doesn't work if the return type is not explicit
Comment #3 by github-bugzilla — 2016-10-01T11:48:12Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/0456f3f05909c510d2c2631c4364aaf2876c74ac fix Issue 16226 - -dip25 doesn't work if the return type is not explicit https://github.com/dlang/dmd/commit/d49c50e0300e810e907baaf2e42ef9b08be9d761 Merge pull request #5900 from WalterBright/fix16226