[Issue 14948] [Reg 2.068.0] AA key requirement was broken w/o notice and w/ horrible error message

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 24 21:23:03 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14948

--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> ---
The reproduce case I can guess (HTTP is a struct in std.net.curl):

void main()
{
    import std.net.curl;
    int[HTTP] aa;
}

The error message "AA key type X supports const equality but doesn't support
const hashing" has introduced from 2.066.

http://dlang.org/changelog/2.066.0.html#aa-key-requirement

If a struct has elaborate equality but doesn't have corresponding hash
calculation, the error will be reported to avoid silent AA behavior breaking.

When we change the requirement for AA key from ordering to equality, we decided
to change everything at once. Therefore no deprecation pass had been introduced
there.

In 2.068, issue 14806 has been fixed. HTTP struct is defined as follows:

struct HTTP {
    ...
    private RefCounted!Impl p;
}

By that bug fix, it's silently changed to a struct which has elaborate
field-wise equality without corresponding toHash method.

In short, it's a problem in the definition of HTTP struct. It had had to be
detected and fixed before the 2.066 release, but unfortunately it wasn't.

--


More information about the Digitalmars-d-bugs mailing list