[Issue 18918] New: core.internal.hash should perform memberwise hashing of structs with references
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 30 19:40:18 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18918
Issue ID: 18918
Summary: core.internal.hash should perform memberwise hashing
of structs with references
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: n8sh.secondary at hotmail.com
So the following passes:
```d
unittest
{
static struct S { char[] array; }
auto s1 = S("abc".dup);
auto s2 = S(s1.array.dup);
import core.internal.hash : hashOf;
assert(hashOf(s1) == hashOf(s2));
```
The eventual goal is to make core.internal.hash usable as a replacement for
`typeid(x).getHash(&x)` that doesn't require runtime type info (useful for
`betterC`) and doesn't ignore `const`-correctness.
--
More information about the Digitalmars-d-bugs
mailing list