Bug 11712 – Unicode bug in std.string.inPattern

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-09T08:09:00Z
Last change time
2013-12-09T22:35:46Z
Assigned to
nobody
Creator
qznc

Comments

Comment #0 by qznc — 2013-12-09T08:09:19Z
The following assert fails, but should not. assert(!inPattern('a', "äöüa-z")); The problem is the combination of "foreach (size_t i, dchar p; pattern)" with "i + 1 < pattern.length". Due to foreach "i" is the index of the code point, but the comparison assumes an index of code unit. The pattern string consists of 6 code points, but 9 code units.
Comment #1 by qznc — 2013-12-09T22:35:46Z
Sorry, confusion on my part. The assertion is wrong, inPattern is correct.