www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18963] New: Relax restrictions on 'return' parameters when

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 puremagic.com
          Reporter: bugzilla 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.

--
Jun 09 2018