Shadowing of members

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Jan 9 14:22:19 PST 2013


On 1/9/13, Walter Bright <newshound2 at digitalmars.com> wrote:
> It is not a bug.

Something related I want to ask you about:

struct S
{
    int _m;
    this(int m)
    {
        this._m = _m;  // meant "this._m = m;"
    }
}

I'd like to add a warning for identity assignments when it involves a
parameter and a field of the aggregate which is the parent of the
function. This was filed as
http://d.puremagic.com/issues/show_bug.cgi?id=4407.

Personally I've had this happen to me quite a few times, and I've seen
it reported on IRC by other people. We could add a check when warnings
are turned on. Thought I'd get a taste of that "preapproved" tag ;).


More information about the Digitalmars-d mailing list