www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23590] New: Deprecation: scope variable 'bar' assigned to

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

          Issue ID: 23590
           Summary: Deprecation: scope variable 'bar' assigned to
                    non-scope parameter '_param_2' calling formattedWrite
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: elpenguino+D gmail.com

```
import std.format;
void foo(scope immutable(char)[][] bar)  safe {
        static struct Result {
                void put(char c)  safe {}
        }
        Result().formattedWrite("%s", bar);
}
```
The interesting thing about this code is that the deprecation vanishes if bar
is `scope immutable(ubyte)[][]` instead. Copying formattedWrite into this
module seems to make the warning go away as well, so I wasn't able to reduce
this example any further.

--
Dec 29 2022