Bug 4819 – "this" in classes should not an lvalue

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-09-05T09:05:00Z
Last change time
2015-06-09T05:11:51Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
jemandy

Comments

Comment #0 by jemandy — 2010-09-05T09:05:44Z
"this" is treated as an lvalue. For classes, it should be an rvalue. In particular, the following absurdity compiles in v1.063 and v.2.047 but should not. class Yikes { int i; this() { this = null; } } void main() { auto y = new Yikes(); } See also discussion at http://www.digitalmars.com/d/archives/digitalmars/D/this_as_lvalue_116836.html
Comment #1 by yebblies — 2012-01-29T03:44:26Z
*** This issue has been marked as a duplicate of issue 780 ***