[Issue 5435] New: Static foreach over tuple ignores type annotation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 8 18:31:41 PST 2011


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

           Summary: Static foreach over tuple ignores type annotation
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: necroment at gmail.com


--- Comment #0 from Max Klyga <necroment at gmail.com> 2011-01-08 18:29:56 PST ---
import std.stdio; 

template Tuple(E...) { alias E Tuple; } 
enum Type { A, B, C };
alias Tuple!(Type.A, Type.B, Type.C, "foo", 3.0) tuple; 

void main() {
  foreach (Type foo; tuple)
    writeln(foo);
  foreach (string foo; tuple)
    writeln(foo);
  foreach (int foo; tuple)
    writeln(foo);
}
---------

This code compiles and runs without errors, printing every element of tuple.

Should the compiler reject static foreach with explicit type annotations ?

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


More information about the Digitalmars-d-bugs mailing list