digitalmars.D.bugs - [Issue 11292] New: Cannot re-initialize a const field in postblit
- d-bugmail puremagic.com (34/34) Oct 18 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11292
- d-bugmail puremagic.com (11/34) Oct 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11292
http://d.puremagic.com/issues/show_bug.cgi?id=11292 Summary: Cannot re-initialize a const field in postblit Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: samukha voliacable.com PDT --- struct S { immutable int x; this(int x) { this.x = x; } this(this) { x = 1; } } void main() { S s = S(1); S s2 = s; } Error: can only initialize const member x inside constructor Postblit is a constructor. Why re-initialization is allowed for the state copied from .init and not for the state copied from the source struct? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 18 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11292 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-validstruct S { immutable int x; this(int x) { this.x = x; } this(this) { x = 1; } } void main() { S s = S(1); S s2 = s; } Error: can only initialize const member x inside constructor Postblit is a constructor. Why re-initialization is allowed for the state copied from .init and not for the state copied from the source struct?This is definitely a compiler bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 21 2013