[Issue 22967] New: [dip1000] no return ref inference for extended return semantics

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 2 14:18:39 UTC 2022


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 at puremagic.com
          Reporter: dkorpel at 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;
}
```

--


More information about the Digitalmars-d-bugs mailing list