[Issue 1464] New: "static" foreach breaks CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 31 08:28:17 PDT 2007


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

           Summary: "static" foreach breaks CTFE
           Product: D
           Version: 2.003
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: reiner.pope at gmail.com


The following code gives compile-time error, "cannot evaluate gen() at compile
time." Removing the "i" from the foreach fixes this.

template Tuple(T...)
{
        alias T val;
}

alias Tuple!(int) Tup;

string gen()
{
    foreach (i, type; Tup.val)
    {
    }
    return null;
}

string text = gen();


-- 



More information about the Digitalmars-d-bugs mailing list