www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21202] New: [REG2.093] std.algorithm.mutation.moveEmplace

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

          Issue ID: 21202
           Summary: [REG2.093] std.algorithm.mutation.moveEmplace cannot
                    deduce purity and errors
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

This code no longer works since dlang 2.093:

```
struct Strukt2 {
    this(int* _block) {  }
}

struct Strukt {
    int* block;
    Strukt2 foo() { return Strukt2(null); }
    alias foo this;
}

void johan() {
    Strukt a;
    Strukt b;
    import std.algorithm.mutation: moveEmplace;
    moveEmplace(a, b);
}
```

Error: `pure` function
`std.algorithm.mutation.moveEmplace!(Strukt).moveEmplace` cannot call impure
function `std.algorithm.mutation.moveEmplaceImpl!(Strukt).moveEmplaceImpl`

Can be fixed by annotating `moveEmplaceImpl` with `pure`.

--
Aug 27 2020