https://issues.dlang.org/show_bug.cgi?id=18590
Issue ID: 18590 Summary: nothrow constructor call still type-checks destructor for purity Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P2 Component: dmd Assignee: nob...@puremagic.com Reporter: c...@dawg.eu cat > bug.d << CODE extern(C) int printf(const char*, ...); struct F { static F create() pure nothrow { return F(1); } this(int) pure nothrow { } ~this() { printf("~this\n"); } } CODE dmd -c bug ---- Error: pure function 'bug.F.create' cannot call impure function 'bug.F.~this' ---- Apparently happens because `F(1)` is lowered to `(tmp = F(1)),tmp` internally. https://github.com/dlang/dmd/blob/93804714c4091a8d867c09ca7b5bf332acb34dfb/src/dmd/expression.d#L3931 --