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

           Summary: [CTFE] UTF-decoding foreach gives wrong index
                    (1-indexed)
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: cbkbbej...@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbej...@mailinator.com> 2011-08-26 
11:04:43 PDT ---
int[] foo(string str)
{
    int[] ret;
    foreach(i, dchar c; str)
        ret ~= i;

    return ret;
}
pragma(msg, foo("Hi"));

Expected: [0,1]
Actual:   [1,2]

Among other likely problems, this causes stripLeft to give the wrong result at
compile-time:

// Should fail, but currently passes:
static assert(stripLeft(" Hello") == "ello");

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

Reply via email to