[Issue 5223] New: [qtd] Cannot use default value with function parameter of struct type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 16 09:37:40 PST 2010


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

           Summary: [qtd] Cannot use default value with function parameter
                    of struct type
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: samukha at voliacable.com


--- Comment #0 from Max Samukha <samukha at voliacable.com> 2010-11-16 09:36:29 PST ---
Struct constructors are disregarded when a struct parameter is constructed out
of a default value:

struct S2
{
}

struct S
{
    int x;

    this(S2 s2)
    {
    }

    void foo(S s = S(S2))
    {
    }
}

void main()
{
    S s;
    s.foo(); // error
}

Error: cannot implicitly convert expression (S2()) of type S2 to int.

-- 
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