[Issue 15813] extern (C++) classes cannot be used as associative array keys

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 19 05:23:36 UTC 2020


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

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang at gmail.com

--- Comment #3 from Mathias LANG <pro.mathias.lang at gmail.com> ---
Martin posted the following comment about why this happens:

```
Because TypeInfo_Class casts every void* to a standard Object, it ends up
calling the wrong vtable entries for operations like getHash.

I think we need a dedicated TypeInfo_CppClass that is similar to
TypeInfo_Struct with it's xopEquals and xopHash in order to fix this bug.
C++ classes don't inherit from the common Object class, so those methods must
not exist.
```

--


More information about the Digitalmars-d-bugs mailing list