[Issue 21202] New: [REG2.093] std.algorithm.mutation.moveEmplace cannot deduce purity and errors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 27 20:46:42 UTC 2020


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 at puremagic.com
          Reporter: johanengelen at 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`.

--


More information about the Digitalmars-d-bugs mailing list