digitalmars.D.bugs - [Issue 19143] New: error or warn when assigning `this.foo = foo`
- d-bugmail puremagic.com (31/31) Aug 06 2018 https://issues.dlang.org/show_bug.cgi?id=19143
https://issues.dlang.org/show_bug.cgi?id=19143 Issue ID: 19143 Summary: error or warn when assigning `this.foo = foo` when the lone foo is this.foo (i.e.not a constructor parameter) Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: iamthewilsonator hotmail.com struct Foo { int i; this (int ii) { this.i = i; } } void main() { auto foo = Foo(2); import std.stdio : writeln; writeln(foo); // prints Foo(0); } should error or at least warn. It leads to very confusing behaviours (you think i is assigned but its not). --
Aug 06 2018