D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4819 - "this" in classes should not an lvalue
Summary: "this" in classes should not an lvalue
Status: RESOLVED DUPLICATE of issue 780
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2010-09-05 09:05 UTC by John Mandeville
Modified: 2015-06-09 05:11 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description John Mandeville 2010-09-05 09:05:44 UTC
"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 yebblies 2012-01-29 03:44:26 UTC

*** This issue has been marked as a duplicate of issue 780 ***