www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22107] New: [scope][dip1000] Can't .dup an array of structs


          Issue ID: 22107
           Summary: [scope][dip1000] Can't .dup an array of structs with
                    impure copy constructor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

Not sure if this is a druntime bug or a compiler bug:

//////////////// test.d ///////////////
 safe unittest
    static int i;
     safe struct S
        this(this) { i++; }

    void fun(scope S[] values...)  safe

$ dmd -o- -unittest -preview=dip1000 test.d
test.d(11): Error: scope variable `values` assigned to non-scope parameter `a`
calling object.dup!(S).dup

Jul 06 2021