Bug 8475 – postblits fails attributes qualifying when in a template.
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-30T14:09:00Z
Last change time
2012-09-22T23:54:44Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
rtcvb32
Comments
Comment #0 by rtcvb32 — 2012-07-30T14:09:06Z
T func2(T)(T x) @safe pure {
return T();
}
struct XY {
this(this) @safe pure {} //safe pure added so func can call it, shows bug
void func(XY x) @safe pure {
XY y = x;
func2(x);
func2(y);
}
}
template X(bool something) {
struct XY {
this(this) @safe pure {}
void func(XY x) @safe pure {
XY y = x; //Error: see below
func2(x);
func2(y);
}
}
}
alias X!(true).XY Xtrue;
produces:
pure function 'func' cannot call impure function '__cpctor'
safe function 'func' cannot call system function '__cpctor'
if func2 is writeln() they too will complain about the postblits being impure/system during the copy step, along with writeln being impure.