[Issue 5752] New: Incorrect memoisation during function parameter name introspection

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 19 04:08:08 PDT 2011


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

           Summary: Incorrect memoisation during function parameter name
                    introspection
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: johnaston.dev at gmail.com


--- Comment #0 from John Aston <johnaston.dev at gmail.com> 2011-03-19 04:04:52 PDT ---
import std.stdio;

int funcOne(int paramOne)
{
    return paramOne + 1;
}

int funcOther(int paramOther)
{
    return paramOther + 1;
}

void printFunc(alias f)()
{
    writeln(__traits(identifier,f)," : ",(typeof(&f)).stringof);
}

void main()
{
    printFunc!funcOne();
    printFunc!funcOther();
}

The above code returns on dmd.2.052:
funcOne : int function(int paramOne)
funcOther : int function(int paramOne)

Since the stringof property goes via the type rather than the alias, two
functions with different parameter names but the same type signature will be
confused.  The extraction of the parameter names I find very useful for
automatic function reflection.

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