Thread overview
[Issue 6630] New: Assigning null to class with nested alias this class is misinterpreted
Sep 08, 2011
dawg@dawgfoto.de
Sep 09, 2011
Kenji Hara
Sep 13, 2011
Walter Bright
Oct 04, 2011
Kenji Hara
September 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6630

           Summary: Assigning null to class with nested alias this class
                    is misinterpreted
           Product: D
           Version: D2
          Platform: Other
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dawg@dawgfoto.de


--- Comment #0 from dawg@dawgfoto.de 2011-09-08 16:04:03 PDT ---
version = Stage1;
version = Stage2;

class A {
  this() { b = new B(); }
  B b;
  alias b this;
}

class B {
}

void fun(A a)
{
  a = null;
  version (Stage1)
    assert(a is null);
}

void main() {
  auto a = new A;
  assert(a.b !is null);
  fun(a);
  assert(a !is null);
  version (Stage2)
    assert(a.b !is null);
}

---

If you want to nullify an reference to a and assign null to it, instead a's reference to b is nullified.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 09, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6630


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, wrong-code


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-09-09 07:34:42 PDT ---
https://github.com/D-Programming-Language/dmd/pull/374

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 13, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6630


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-09-12 23:02:53 PDT ---
https://github.com/D-Programming-Language/dmd/commit/7569c39e911c813a6145810cbdd356071e05ee5c

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 04, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6630


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2011-10-04 13:22:11 PDT ---
*** Issue 6378 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------