Bug 4596 – [tdpl] Rebinding *this* in class method compiles

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-08-07T17:43:00Z
Last change time
2012-12-31T03:22:10Z
Keywords
accepts-invalid, patch, TDPL
Assigned to
nobody
Creator
andrej.mitrovich
See also
http://d.puremagic.com/issues/show_bug.cgi?id=780

Comments

Comment #0 by andrej.mitrovich — 2010-08-07T17:43:48Z
This should not compile (from TDPL): import std.stdio; class NoGo { void fun() { this = new NoGo; } } void main() { } unittest { auto n = new NoGo; n.fun(); } There are no runtime errors.
Comment #1 by k.hara.pg — 2011-12-25T02:30:01Z
Comment #2 by andrej.mitrovich — 2012-01-21T16:57:35Z
This also seems a dup of Issue 780, so that should be closed when that pull is merged.
Comment #3 by k.hara.pg — 2012-01-22T05:10:14Z
(In reply to comment #2) > This also seems a dup of Issue 780, so that should be closed when that pull is > merged. Bug 780 is marked as D1 issue. And my patch contains some other fixes around assignment, so merging the changes into D1 branch will be difficult. In other words, D1 branch will require another patch to fix the "rebinding this" problem. So I think we should not close bug 780 by merging my patch into D2.
Comment #4 by github-bugzilla — 2012-10-07T10:27:24Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/727263351eec94c979e7f718509de3afde4cbb30 fix Issue 4596 - [tdpl] Rebinding *this* in class method compiles https://github.com/D-Programming-Language/dmd/commit/c4324fd970f31c39b7efe96e4acfe26732925edf Merge pull request #1169 from 9rnsr/fix4596 Issue 4596 - [tdpl] Rebinding *this* in class method compiles
Comment #5 by yebblies — 2012-10-07T11:51:16Z
Comment #6 by andrej.mitrovich — 2012-11-27T17:15:02Z
Note: http://d.puremagic.com/issues/show_bug.cgi?id=9079#c2 And Walter's comment: http://d.puremagic.com/issues/show_bug.cgi?id=780#c3 I'm not sure whether we should revert this or not. Those 4 steps Walter mentioned could have already been taken since this report was first made (even though he mentions it only this year). Unfortunately this is what happens when development procedures are written in comments instead of a more visible place..
Comment #7 by andrej.mitrovich — 2012-11-27T17:16:24Z
(In reply to comment #6) > Unfortunately this is what happens when development procedures are written in > comments instead of a more visible place.. Actually things aren't *that* grim, because this only affects Git head. So the pull for this can be reverted without much problems methinks..
Comment #8 by mike — 2012-12-31T03:22:10Z
http://d.puremagic.com/issues/show_bug.cgi?id=780#c3 : > Since code like gtkd relies on allowing it, Since reverting this has come up a few times already, i'd like to note that GtkD no longer depends on reassigning this.