When getHash is overridden, it may try to dereference the void pointer, so it's not safe if the pointer is to the wrong type.
import std.string;
static int x = 35873;
@safe
void main() {
typeid(string).getHash(&x);
}
---
An example program which segfaults within a @safe method
Comment #1 by bugzilla — 2018-03-12T09:31:25Z
To fix this would probably involve creating a template called getHash2(T)(ref T v) or something like that in TypeInfo, and then using parametric polymorphism on it.
Comment #2 by robert.schadek — 2024-12-07T13:33:37Z