www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22967] New: [dip1000] no return ref inference for extended

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

          Issue ID: 22967
           Summary: [dip1000] no return ref inference for extended return
                    semantics
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

When returning a parameter by assignment to the first ref parameter, return
scope can be inferred when it's a template/auto function. This is not the case
for return ref yet:
```
 safe:   
struct S()
{
    int* x;
    this(scope int* x) { this.x = x; } // return scope inferred
    this(ref int x) { this.x = &x; } // no return ref inferred, error
}

void main()
{
    S!() s;
}
```

--
Apr 02 2022