May 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20815

          Issue ID: 20815
           Summary: Wrong purity inference for postblit and copy
                    constructor in template struct
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: atila.neves@gmail.com

The code below shouldn't compile, but does. The postblit function is obviously not pure, but pure code is allowed to call it. Interestingly, marking the postblit as pure explicitly causes it to no longer compile.

--------------------------------
struct Struct(T) {
    this(this) {
        import std.stdio;
        writeln("oops");
    }
}

void fun(Struct!int s) pure;

void gun() pure {
    fun(Struct!int());
}

--------------------------------

--