digitalmars.D.bugs - [Issue 6588] New: Struct d'tors + immutable elements doesn't work
- d-bugmail puremagic.com (28/28) Sep 01 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6588
- d-bugmail puremagic.com (24/24) Sep 03 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6588
- d-bugmail puremagic.com (10/10) Apr 27 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6588
- d-bugmail puremagic.com (23/23) Nov 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6588
http://d.puremagic.com/issues/show_bug.cgi?id=6588 Summary: Struct d'tors + immutable elements doesn't work Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dsimcha yahoo.com Blocks: 6587 struct Task(Args...) { Args _args; this(Args args) { _args = args; } ~this() {} // Bug goes away without this. } alias Task!(int function(immutable int), immutable(int)) F; Error: can only initialize const member __args_field_1 inside constructor Error: this is not mutable -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 01 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6588 This is built-in opAssign issue. When struct has only dtor, built-in opAssign is implemented automatically by compiler with memberwise assign. struct Task(Args...) { Args _args; this(Args args) { _args = args; } ~this() {} // Bug goes away without this. // Inserted automatically by compiler. // This code does not have file positions, so error message displays // no position. ref typeof(this) opAssign(typeof(this) rhs) { this._args = rhs.args; // immutable field assign outside constructor causes error return this; } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 03 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6588 SomeDude <lovelydear mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear mailmetrash.com PDT --- Compiles on 2.059 Win32 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 27 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6588 Marco Leise <Marco.Leise gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Marco.Leise gmx.de Thanks I think in my case I can then implement opAssign to skip the assignment of immutable fields. Here is a real short test case without templates: struct Bug6588 { immutable int x; ~this() {} } Also this is related: struct Bug6588 { immutable int x; ref Bug6588 test() { return this; } // this is not mutable ref const(Bug6588) test() { return this; } // ok } The compiler has a hard time with partial const/immutable structures. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 10 2012