www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24453] New: [REG2.108] idup fails for inout(T)[] slices

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

          Issue ID: 24453
           Summary: [REG2.108] idup fails for inout(T)[] slices
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

This regressed with v2.108 (tested with rc1):

```
inout(char)[] foo(ref scope return inout(char)[] s)
{
        auto bla = s.idup;
        return s;
}
```

Output:
```
core/internal/array/construction.d(342): Error: `inout` on `return` means
`inout` must be on a parameter as well for `pure nothrow  trusted
inout(char)[](size_t length, bool isShared = false)`
core/internal/array/duplication.d(24): Error: template instance
`core.internal.array.construction._d_newarrayUPureNothrow!(inout(char))` error
instantiating
object.d(3876):        instantiated from here: `_dup!(inout(char),
immutable(char))`
reg2108.d(3):        instantiated from here: `idup!(inout(char))`
```

Not sure if it's a compiler or druntime regression.

--
Mar 26