www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20661] New: opEquals not recognized for AA key (take two)

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

          Issue ID: 20661
           Summary: opEquals not recognized for AA key (take two)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

This is a slight variation of issue 20136, adding ` safe` and a pointer.

Should compile:

----
class Context
{
    size_t[const(Key)] aa; /* Error: AA key type Key does not have bool
opEquals(ref const Key) const */
    bool* checkAll;
}

struct Key
{
    Context context;
    bool opEquals(ref const Key other)  safe const
    {
        auto c = context.checkAll;
        return true;
    }
}
----

--
Mar 10 2020