[Issue 23590] New: Deprecation: scope variable 'bar' assigned to non-scope parameter '_param_2' calling formattedWrite
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Dec 29 23:41:05 UTC 2022
    
    
  
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 at puremagic.com
          Reporter: elpenguino+D at 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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list