Thread overview
[Issue 24034] Changing this in constructor allows to modify immutable members of other instance
Jul 06
Tim
Jul 10
RazvanN
July 06
https://issues.dlang.org/show_bug.cgi?id=24034

Tim <tim.dlang@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=24024

--
July 10
https://issues.dlang.org/show_bug.cgi?id=24034

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com
           Severity|normal                      |regression

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
Yeah, this is bad. I guess `this` should not be modifiable for classes when used in constructors. For normal functions it could be allowed.

--
March 23
https://issues.dlang.org/show_bug.cgi?id=24034

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |nick@geany.org
         Resolution|---                         |FIXED

--- Comment #2 from Nick Treleaven <nick@geany.org> ---
The pull for issue 24024 was reverted and it was marked WONTFIX.

Assignment to `this` now gives:

thislval2.d(8): Error: cannot modify expression `this` because it is not an
lvalue

--