Bug 18742 – std.regex: Using CodePointSet in AAs breaks if reference count changes

Status
NEW
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-04-07T15:11:05Z
Last change time
2024-12-01T16:33:28Z
Keywords
bootcamp
Assigned to
No Owner
Creator
Johannes Pfau
Blocks
17206
Moved to GitHub: phobos#10329 →

Comments

Comment #0 by johannespfau — 2018-04-07T15:11:05Z
When storing a CodePointSet in an AA, the reference count member is included when hashing, so two identical CodePointSets only differing in the reference count are not considered as the same AA key. std.regex does actually put CodePointSets into AAs, so this seems very fragile. As a solution, CodePointSet should properly implement the toHash function. Test case: -------------------------------------- import std.uni, std.stdio; void main() { int[CodepointSet] aa; auto set = unicode.Nd; aa[set] = 42; writeln(aa[set]); } -------------------------------------- This is expected to print 42, but currently throws a RangeError instead.
Comment #1 by bugzilla — 2019-12-19T13:59:19Z
Seems to me, this is a CodePointSet issue and not a regex...
Comment #2 by robert.schadek — 2024-12-01T16:33:28Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10329 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB