[Issue 2953] New: tuple.length rejected as a tuple parameter in a static foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 8 01:41:10 PDT 2009


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

           Summary: tuple.length rejected as a tuple parameter in a static
                    foreach
           Product: D
           Version: 1.042
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


This bug was created from Bug 2687.
Workaround (D2), change the foreach to enum args_length = args.length; foreach(
x ; Range!(args_length) ){ }

---

template Tuple(T...){
    alias T Tuple;
}
template Range(int b){
        alias Tuple!(1) Range;
}
void foo()(){
     Tuple!(int, int) args;
     foreach( x ; Range!(args.length) ){ }
}

void main(){
    foo!()();
}
---
ice.d(411): Error: identifier 'length' of 'args.length' is not defined
ice.d(411): Error: template instance Range!(int) does not match template
declara
tion Range(int b)
ice.d(411): Error: foreach: void is not an aggregate type
ice.d(416): Error: template instance ice.foo!() error instantiating


-- 



More information about the Digitalmars-d-bugs mailing list