``` 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.
@wolframw created dlang/phobos pull request #7465 "Fix Issue 20783 - std.string.lastIndexOf doesn't work correctly in CTFE" fixing this issue: - Fix Issue 20783 - std.string.lastIndexOf doesn't work correctly in CTFE https://github.com/dlang/phobos/pull/7465
dlang/phobos pull request #7465 "Fix Issue 20783 - std.string.lastIndexOf doesn't work correctly in CTFE" was merged into master: - c57990ceda8e0108554abde9eed0fc04e4041529 by wolframw: Fix Issue 20783 - std.string.lastIndexOf doesn't work correctly in CTFE https://github.com/dlang/phobos/pull/7465