Bug 6084 – Impossible to instantiate local template with TypeTuple-foreach iterator variable.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-01T01:14:00Z
Last change time
2011-09-25T13:28:49Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2011-06-01T01:14:15Z
The following code is rejected by DMD:
import std.typetuple;
void main(){
int foo(int x)(){return x;}
foreach(i;TypeTuple!(0)) foo!(i);
}
Error: template instance cannot use local 'i' as parameter to non-global template foo(int x)
'i' is only a compile-time constant integral value at the point of instantiation, therefore there is no reason why this should not work.