[Issue 5850] New: Default arguments of out and ref arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 16 18:14:59 PDT 2011


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

           Summary: Default arguments of out and ref arguments
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-04-16 18:11:29 PDT ---
This D2 program compiles with no errors and runs raising no assert errors:

void foo(out int x=1, ref int y=2) {}
void main() {
    int x, y;
    foo(x, y);
    assert(x == 0 && y == 0);
}


If default arguments for out and ref arguments can't be made to work, then I
suggest to disallow them statically.

In Ada (2012) "A default_expression is only allowed in a
parameter_specification for a formal parameter of mode in." See point 19 here:
http://www.ada-auth.org/standards/12rm/html/RM-6-1.html

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