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

           Summary: clear() does not call base constructor if a class does
                    not implement a default constructor
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: s...@invisibleduck.org
        ReportedBy: lutger.blijdest...@gmail.com


--- Comment #0 from Lutger <lutger.blijdest...@gmail.com> 2010-08-09 16:58:36 
PDT ---
If a class only defines a constructor with one or more parameters and no
default constructor, clear() does not call any constructor of the base classes
nor does it throw an exception.

class A
{
    int n = -1;
    this() {
        n = 0;
    }
}

class B : A
{
    // uncomment the following line and the unittest will pass
    // this(){}

    this(int b) {
        n = b;
    }
}

unittest
{
    auto foo = new B(42);
    assert( foo.n == 42 );
    clear(foo);
    assert( foo.n == 0 ); //fails
}

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

Reply via email to