www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22289] New: Can't `std.algorithm.mutation: copy` a `scope`


          Issue ID: 22289
           Summary: Can't `std.algorithm.mutation: copy`  a `scope` string
                    into an an `Appender` with DIP1000
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: industry, safe
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

import std.algorithm.mutation : copy;
import std.array : Appender;

void issueXXX (scope const char[] data)  safe
    Appender!string buffer;
    copy(data, buffer);

Expected: Compiles
Actual result when compiled with `-preview=dip1000`:
onlineapp.d(7): Error: scope variable `data` assigned to non-scope parameter
`source` calling std.algorithm.mutation.copy!(const(char)[],

This affects https://github.com/dlang-community/D-YAML

Sep 07 2021