www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14947] New: std.traits: ParameterIdentifierTuple on an

https://issues.dlang.org/show_bug.cgi?id=14947

          Issue ID: 14947
           Summary: std.traits: ParameterIdentifierTuple on an 'interface'
                    not working
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: s_dlang_bugzilla asylum.id.au

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);
    }
}

--
Aug 22 2015