D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18963 - Relax restrictions on 'return' parameters when parameter is not a pointer
Summary: Relax restrictions on 'return' parameters when parameter is not a pointer
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-09 20:59 UTC by Walter Bright
Modified: 2021-04-10 11:44 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2018-06-09 20:59:48 UTC
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 Walter Bright 2018-06-09 21:15:43 UTC
https://github.com/dlang/dmd/pull/8346
Comment 2 github-bugzilla 2018-06-14 22:39:22 UTC
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 <andralex@users.noreply.github.com>
Comment 3 Dlang Bot 2021-04-10 11:44:34 UTC
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