digitalmars.D.bugs - [Issue 15266] New: Parameters to methods of final classes become
- via Digitalmars-d-bugs (33/33) Oct 30 2015 https://issues.dlang.org/show_bug.cgi?id=15266
https://issues.dlang.org/show_bug.cgi?id=15266 Issue ID: 15266 Summary: Parameters to methods of final classes become uninitialised in out contracts for DMD only Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: lt.infiltrator gmail.com -------------------------- 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. --
Oct 30 2015