November 05, 2014 [Issue 13688] New: 'in' expression for AA not detected as GC usage | ||||
---|---|---|---|---|
| ||||
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; } -- |
Copyright © 1999-2021 by the D Language Foundation