Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/core/internal/hash.d
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ size_t hashOf(T)(auto ref T val, size_t seed = 0) if (!is(T == enum) && __traits
@trusted nothrow pure
size_t hashOf(T)(auto ref T val, size_t seed = 0) if (!is(T == enum) && is(T : typeof(null)))
{
return hashOf(cast(void*)null);
return hashOf(cast(void*)null, seed);
}

//Pointers hash. CTFE unsupported if not null
Expand All @@ -107,15 +107,15 @@ if (!is(T == enum) && is(T V : V*) && !is(T : typeof(null))
{
if(val is null)
{
return hashOf(cast(size_t)0);
return hashOf(cast(size_t)0, seed);
}
else
{
assert(0, "Unable to calculate hash of non-null pointer at compile time");
}

}
return hashOf(cast(size_t)val);
return hashOf(cast(size_t)val, seed);
}

//struct or union hash
Expand Down Expand Up @@ -394,6 +394,8 @@ unittest
assert(h28 == rth28);
assert(h29 == rth29);*/
assert(h30 == rth30);

assert(hashOf(null, 0) != hashOf(null, 123456789)); // issue 18932
}


Expand Down