Bug 18963 – Relax restrictions on 'return' parameters when parameter is not a pointer

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-09T20:59:48Z
Last change time
2021-04-10T11:44:34Z
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2018-06-09T20:59:48Z
Consider: T Identity(T)(return T t) { return t; } void bar(int i, void* p) { Identity(p); // no error Identity(i); // Error: parameter t is return but function // does not return any indirections } The error unreasonably impairs the creation of generic code, and so 'return' should simply be ignored for such cases.
Comment #1 by bugzilla — 2018-06-09T21:15:43Z
Comment #2 by github-bugzilla — 2018-06-14T22:39:22Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/d8793c0db1eb7e981429f2bb06b45ebb023820da fix Issue 18963 - Relax restrictions on 'return' parameters when parameter is not a pointer https://github.com/dlang/dmd/commit/7bf48f8a80f776bf019c2bd48f77850d3ade065c Merge pull request #8346 from WalterBright/fix18963 fix Issue 18963 - Relax restrictions on 'return' parameters when para… merged-on-behalf-of: Andrei Alexandrescu <[email protected]>
Comment #3 by dlang-bot — 2021-04-10T11:44:34Z
dlang/dmd pull request #12418 "[dmd-cxx] fix Issue 18963 - Relax restrictions on 'return' parameters when parameter is not a pointer" was merged into dmd-cxx: - 07a419b3bff45ce79526cb67c913e3bf8c0540c0 by Walter Bright: [dmd-cxx] fix Issue 18963 - Relax restrictions on 'return' parameters when parameter is not a pointer https://github.com/dlang/dmd/pull/12418