[Issue 7211] Initializing const members in derived classes' constructors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 5 15:14:12 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=7211

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |FIXED

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
As Maksim said, the error has changed to "test.d(10): Error: cannot modify
immutable expression this.x". This  is the correct behavior since x is
constructed in the implicit super call to C. When D's constructor tries to
modify it, it is already cooked and cannot be modified. Closing as fixed.

--


More information about the Digitalmars-d-bugs mailing list