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.
https://github.com/dlang/dmd/pull/8346
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>
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