this as lvalue?

JMRyan nospam at nospam.com
Fri Sep 3 13:22:51 PDT 2010


I wouldn't have thought of "this" representing an lvalue.  However, the
following absurdity compiles and executes flawlessly.  Just don't
uncomment the assignment to y.i! 

class Yikes
{
    int i;
    this() { this = null; }
}


void main()
{
    auto y = new Yikes();
    // y.i = 0;
}

Is this a bug in the compiler (v.2.047)?  Am I missing something in 
thinking it shouldn't be?


More information about the Digitalmars-d mailing list