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

           Summary: Default initializer is allowed on ref/out params
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2012-02-27 
18:44:34 PST ---
void test1(ref bool val = true) {
}

void test2(out bool val = true) {
}

void main()
{
    bool x;
    test1(x);  // compiles ok
    test2(x);  // compiles ok

    test1();  // Error: constant true is not an lvalue
    test2();  // Error: constant true is not an lvalue
}

The compiler should probably disallow that kind of function signature
regardless of any calls. The initializer doesn't really do anything.

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

Reply via email to