[Issue 4500] New: scoped moves class after calling the constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 23 23:59:59 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4500

           Summary: scoped moves class after calling the constructor
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: andrei at metalanguage.com
        ReportedBy: kamm-removethis at incasoftware.de


--- Comment #0 from Christian Kamm <kamm-removethis at incasoftware.de> 2010-07-23 23:59:57 PDT ---
As far as I remember a class is not supposed to move.

class A {
  this() { a = this; }
  this(int i) { a = this; }
  A a;
  void check() { writeln(this is a); }
}

void main()
{
    auto a1 = scoped!A;
    a1.check(); // fails

    auto a2 = scoped!A(1);
    a2.check(); // fails

    a1.a = a1;
    a1.check(); // ok now
}

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


More information about the Digitalmars-d-bugs mailing list