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

           Summary: Forward reference error for default struct/class
                    arguments
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-10-04 
09:35:05 PDT ---
void test(Bar bar = Bar(1)) { }

struct Bar
{
    this(int x) { }
}
void main() { }

Error: more initializers than fields of Bar

This also affects structs and classes that have methods with default arguments
that call ctors of typeof(this):

class Foo
{
    this(int x) { }
    void test(Foo foo = new Foo(1)) { }
}

struct Bar
{
    this(int x) { }
    void test(Bar bar = Bar(1)) { }
}

void main() {}

test.d(4): Error: no constructor for Foo
test.d(10): Error: more initializers than fields of Bar

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

Reply via email to