Bug 15266 – Parameters to methods of final classes become uninitialised in out contracts for DMD only
Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-10-30T14:32:00Z
Last change time
2015-11-02T02:04:59Z
Assigned to
nobody
Creator
lt.infiltrator
Comments
Comment #0 by lt.infiltrator — 2015-10-30T14:32:08Z
--------------------------
final class C {
void property(uint rate)
out {
assert(_rate == rate, "This will fail");
} body { _rate = rate; }
this() { }
uint _rate;
}
void main() {
auto c = new C;
c.property = 25;
}
--------------------------
This fails with DMD2.066 and 2.068; but succeeds with GDC2.066. I haven't tested with LDC.
Making the class non-final fixes the problem. As does making property() a UFCS function taking C as its first parameter.
Comment #1 by lt.infiltrator — 2015-10-31T14:14:01Z
*** Issue 15271 has been marked as a duplicate of this issue. ***
Comment #2 by k.hara.pg — 2015-11-02T02:04:59Z
This is a dup of issue 14779, and it's fixed from 2.069.0-b1 or later.
*** This issue has been marked as a duplicate of issue 14779 ***