[Issue 20815] New: Wrong purity inference for postblit and copy constructor in template struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat May 9 12:14:31 UTC 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 at puremagic.com
Reporter: atila.neves at 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());
}
--------------------------------
--
More information about the Digitalmars-d-bugs
mailing list