www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5696] New: Templates typetuple iteration

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5696

           Summary: Templates typetuple iteration
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



I am allowed to create a type tuple of function templates, but then it seems I
am not allowed to use a static foreach on that type tuple:


template TypeTuple(TList...) {
    alias TList TypeTuple;
}
int foo(T)(T x) {
    return 0;
}
void main() {
    alias TypeTuple!(foo, foo) t2;
    static assert(t2[0](0) == 0); // OK
    static assert(t2[1](0) == 0); // OK
    foreach (t; t2) {} // Error
}


DMD 2.052 shows:

test.d(11): Error: variable test.main.t voids have no value
test.d(11): Error: template foo(T) has no value
test.d(11): Error: variable test.main.t voids have no value
test.d(11): Error: template foo(T) has no value

See also bug 2411

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 04 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5696


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch



https://github.com/D-Programming-Language/dmd/pull/405

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 22 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5696


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



23:23:48 PDT ---
https://github.com/D-Programming-Language/dmd/commit/fb3e7b117ea6b13ec45bcc80801ab6fed2fbdd4c

https://github.com/D-Programming-Language/dmd/commit/ca4cb397a585dbcf03730cc909d7e57cae6e7bc2

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