D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5696 - Templates typetuple iteration
Summary: Templates typetuple iteration
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-03-04 09:48 UTC by bearophile_hugs
Modified: 2011-09-24 23:23 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-03-04 09:48:45 UTC
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