www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10521] New: Struct wrong constructor chosen.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10521

           Summary: Struct wrong constructor chosen.
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: damianday hotmail.co.uk



// Test case, worked fine in 2.062

struct Test
{
    enum DefaultSize = 256;
    int size;

    this(int sz = DefaultSize )
    {
        size = sz;
    }
}

void main()
{
    Test st_test;
    assert(st_test.size == Test.DefaultSize); // Wrong constructor chosen!
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10521


Damian <damianday hotmail.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 01 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10521




This is a correct test case, ignore the previous one.
Anyway tested now with Git Head and the issue has been resolved! Hooray :)

struct Test
{
    enum DefaultSize = 256;
    int size;

    this(int sz = DefaultSize )
    {
        size = sz;
    }

    ~this()
    {
        assert(size == DefaultSize);
    }
}

public class ClassA
{
    private Test st_test;

    public this()
    {
        st_test = Test(256);
    }
}

void main()
{
    auto cl = new ClassA;
}

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