www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24378] New: [REG 2.104] inout error with -profile=gc

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

          Issue ID: 24378
           Summary: [REG 2.104] inout error with -profile=gc
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: tim.dlang t-online.de

```
inout(char)[] foo(inout(char)[] s) pure  safe
{
    s = s[0..1] ~ '%';
    return s;
}
```

The above code compiled with and without -profile=gc until DMD version 2.103.
Since DMD 2.104 it only compiles without -profile=gc and produces the following
error with -profile=gc:

/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/lifetime.d(1573):
Error: `inout` on `return` means `inout` must be on a parameter as well for
`pure nothrow  nogc  property  safe inout(char)[]()`
/path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/concatenation.d(174):
Error: template instance
`core.internal.array.concatenation._d_arraycatnTXTrace!(inout(char)[],
inout(char)[], inout(char))._d_arraycatnTXTrace.forward!(__param_3, __param_4)`
error instantiating
onlineapp.d(3):        instantiated from here:
`_d_arraycatnTXTrace!(inout(char)[], inout(char)[], inout(char))`

As a result of this issue, compiling DMD itself with -profile=gc does not work
any more.

--
Feb 08