Issue ID: 18742
           Summary: std.regex: Using CodePointSet in AAs breaks if
                    reference count changes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: bootcamp
          Severity: minor
          Priority: P1
         Component: phobos

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;
This is expected to print 42, but currently throws a RangeError instead.


Reply via email to