digitalmars.D.bugs - [Issue 13688] New: 'in' expression for AA not detected as GC usage
- via Digitalmars-d-bugs (37/37) Nov 05 2014 https://issues.dlang.org/show_bug.cgi?id=13688
https://issues.dlang.org/show_bug.cgi?id=13688 Issue ID: 13688 Summary: 'in' expression for AA not detected as GC usage Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: sinkuupump gmail.com 'in' expression for AA calls KeyType.toHash/opEquals if exist, but not detected as GC usage even if these functions are not nogc. Example: (In this case, compiler should require that toHash/opEquals are nogc.) struct KeyType { int x; size_t toHash() const safe nothrow { return x; } bool opEquals(in KeyType r) const { return x == r.x; } } ulong func(ulong[KeyType] aa) nogc { if (auto p = KeyType(10) in aa) // can call KeyType.toHash/opEquals return *p; return aa.length; } --
Nov 05 2014