[Issue 2781] New: alias this doesn't work with foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 1 17:15:13 PDT 2009


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

           Summary: alias this doesn't work with foreach
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dsimcha at yahoo.com


struct Tuple(T...) {
    T data;
    alias data this;
}

void main() {
    Tuple!(uint, float) foo;
    foreach(elem; foo) {}  // Error:  Cannot infer type for elem.
}

The same applies when this is aliased to an array instead of a tuple.


-- 



More information about the Digitalmars-d-bugs mailing list