www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22518] New: [dip1000] return without scope/ref not specified

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

          Issue ID: 22518
           Summary: [dip1000] return without scope/ref not specified
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

I think this should pass:
```
void retsc(return scope int* x);
void ret(return int* x);
static assert(is(typeof(retsc) == typeof(ret)));
```

In the current implementation it doesn't, since `return` adds `scope` with
`STC.scopeinferred` so it's not part of the type's mangle. Since it only
depends on the signature, not any actual function body inference, I think
making this distinction is a needless complication.

I would call this a bug, but since the spec doesn't say anything about `return`
without `scope` or `ref`, I'm filing this as a specification issue.

--
Nov 17 2021