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

           Summary: Template (alias) tuple parameters cannot take .length
                    property in compiletime
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: zan77...@nifty.com


--- Comment #0 from SHOO <zan77...@nifty.com> 2010-09-18 00:54:05 PDT ---
This code doesn't work!
----
auto test(ARGS...)()
{
    int[ARGS.length] x;
    return x;
}

void main(string[] args)
{
    void func(){  }
    auto t = test!(func)();
}
----


Results:
prog.d(3): Error: identifier 'length' of 'ARGS.length' is not defined
prog.d(3): Error: index is not a type or an expression
prog.d(10): Error: template instance prog.main.test!(func) error instantiating


Workaround is this:
----
size_t lengthof(ARGS...)()
{
    return ARGS.length;
}

auto test(ARGS...)()
{
    int[lengthof!(ARGS)()] x;
    return x;
}

void main(string[] args)
{
    void func(){  }
    auto t = test!(func)();
}
----

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

Reply via email to