digitalmars.D.bugs - [Issue 780] New: The assignment of 'this' is allowed
- d-bugmail puremagic.com (38/38) Dec 30 2006 http://d.puremagic.com/issues/show_bug.cgi?id=780
- d-bugmail puremagic.com (18/18) Feb 27 2007 http://d.puremagic.com/issues/show_bug.cgi?id=780
- d-bugmail puremagic.com (10/10) Nov 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=780
- d-bugmail puremagic.com (7/7) Jan 08 2011 http://d.puremagic.com/issues/show_bug.cgi?id=780
- d-bugmail puremagic.com (20/20) Jan 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=780
- d-bugmail puremagic.com (10/10) Jan 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=780
- d-bugmail puremagic.com (11/11) Jan 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=780
- d-bugmail puremagic.com (12/13) Oct 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=780
http://d.puremagic.com/issues/show_bug.cgi?id=780 Summary: The assignment of 'this' is allowed Product: D Version: 0.178 Platform: PC OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: brunodomedeiros+bugz gmail.com The compiler allows assignment of the 'this' special reference. Instead 'this' should be final (i.e., non assignable). In some cases, like in a class constructor, 'this' is treated as if an inout reference, changing a variable in another scope: -------- -------- import std.stdio; class Foo { static bool first = true; this() { if(first){ first = false; this = new Foo(); writefln("this= ", cast(void *)this); } } } void main(char[][] args) { Foo foo = new Foo(); writefln("foo= ", cast(void *)foo); } -------- outputs: -------- this before= 8B0FE0 this after= 8B0FD0 foo= 8B0FD0 --
Dec 30 2006
http://d.puremagic.com/issues/show_bug.cgi?id=780 http://www.digitalmars.com/d/class.html#constructors value However the compiler implements class constructors as returning the this pointer dmd -c wood.d && nm wood.o | grep _ctor | sed "s:.* ::" _D4wood4Tree5_ctorMFZC4wood4Tree demangled: wood.Tree wood.Tree.this(this) --
Feb 27 2007
http://d.puremagic.com/issues/show_bug.cgi?id=780 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |bugzilla digitalmars.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=780 14:10:50 PST --- Before and after return the same thing in 2.051. Nevertheless, assigning to this should be syntactically disallowed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 08 2011
http://d.puremagic.com/issues/show_bug.cgi?id=780 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Platform|x86 |All Version|0.178 |D1 & D2 OS/Version|Windows |All Severity|major |normal 13:40:09 PST --- The spec now disallows assignment to this and super, but the compiler still allows it. Since code like gtkd relies on allowing it, the progression should be: 1. spec change 2. make it a warning 3. deprecate it 4. remove from compiler This will take time. We're at (1). So the bug stays open for now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=780 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jemandy earthlink.net *** Issue 4819 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 29 2012
http://d.puremagic.com/issues/show_bug.cgi?id=780 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://d.puremagic.com/issu | |es/show_bug.cgi?id=4596 After fixing bug 4596, this will be an issue for only D1. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 29 2012
http://d.puremagic.com/issues/show_bug.cgi?id=780 Denis Shelomovskij <verylonglogin.reg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |verylonglogin.reg gmail.com Version|D1 & D2 |D1 16:29:54 MSK ---After fixing bug 4596, this will be an issue for only D1.Bug 4596 is fixed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 30 2012