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

           Summary: Default parameter appears a part of typeof().stringof
                    of a function variable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: acehr...@yahoo.com


--- Comment #0 from Ali Cehreli <acehr...@yahoo.com> 2012-08-22 14:23:55 PDT ---
This is related to bug 3866.

import std.stdio;

void func1(int i, double j = 1.0) {
}

void func2(int i, double j) {
}

void main() {
    auto fn1 = &func1;
    auto fn2 = &func2;

    assert(typeid(fn1) is typeid(fn2));  // Passes; fine.

    writeln(typeof(fn1).stringof);
    writeln(typeof(fn2).stringof);
}

The output includes the default value and for *both* of the variables:

void function(int i, double j = 1)
void function(int i, double j = 1)

Interestingly, swap the definitions of fn1 and fn2, now neither has the default
parameter value:

    auto fn2 = &func2;
    auto fn1 = &func1;

Now the output:

void function(int i, double j)
void function(int i, double j)

Ali

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

Reply via email to