Bug 14947 – std.traits: ParameterIdentifierTuple on an 'interface' not working
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-08-22T07:01:00Z
Last change time
2015-09-03T16:49:53Z
Assigned to
nobody
Creator
s_dlang_bugzilla
Comments
Comment #0 by s_dlang_bugzilla — 2015-08-22T07:01:29Z
for dmd2.068, linux 64bit:
dmd -oftest test.d
(string, uint, bool)
tuple("a", "b", "c")
(string, uint, bool)
tuple("", "", "")
second tuple printout should be the same as the first one.
----------------------------------------
with test.d:
import std.traits;
interface IFoo { ulong foo_me(string a, uint b, bool c); }
class myFoo:IFoo{ ulong foo_me(string a, uint b, bool c){ return 42; } }
void main()
{
auto tmp_foo = new myFoo;
alias ParameterTypeTuple!(tmp_foo.foo_me) tmpfooTypes;
pragma(msg,tmpfooTypes);
alias ParameterIdentifierTuple!(tmp_foo.foo_me) tmpfooNames;
pragma(msg,tmpfooNames);
foreach ( method; __traits(allMembers, IFoo))
{
alias MemberFunctionsTuple!(IFoo, method) funcs;
alias typeof(funcs[0]) func;
alias ReturnType!func return_type;
alias ParameterTypeTuple!func ParameterTypes;
alias ParameterIdentifierTuple!func ParameterNames;
pragma(msg,ParameterTypes);
pragma(msg,ParameterNames);
}
}
Comment #1 by dlang-bugzilla — 2015-09-02T03:30:31Z
If in the example this line:
alias typeof(funcs[0]) func;
...is replaced with this line:
alias funcs[0] func;
then it works fine. If you think that's not the correct solution please reopen the issue.