Bug 5752 – Incorrect memoisation during function parameter name introspection
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-03-19T04:04:00Z
Last change time
2011-06-12T14:55:18Z
Assigned to
nobody
Creator
johnaston.dev
Comments
Comment #0 by johnaston.dev — 2011-03-19T04:04:52Z
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.
Comment #1 by yebblies — 2011-06-12T14:55:18Z
*** This issue has been marked as a duplicate of issue 3358 ***