[Issue 18963] New: Relax restrictions on 'return' parameters when parameter is not a pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 9 20:59:48 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18963

          Issue ID: 18963
           Summary: Relax restrictions on 'return' parameters when
                    parameter is not a pointer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

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.

--


More information about the Digitalmars-d-bugs mailing list