https://issues.dlang.org/show_bug.cgi?id=20783

          Issue ID: 20783
           Summary: std.string.lastIndexOf doesn't work correctly in CTFE
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nob...@puremagic.com
          Reporter: chalu...@gmail.com

```
pragma(msg, "aa".lastIndexOf("ab"));
```

Returns 0 instead of -1.

Problem seems to be with:
https://github.com/dlang/phobos/blob/ffca395ed2e9fd31cdb8e3e67adb8ddfba2607ac/std/string.d#L1345

as it continues foreach loop that should be stopped and instead upper for loop
should continue with next character.

--

Reply via email to