This repository was archived by the owner on Oct 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ size_t hashOf(T)(auto ref T val, size_t seed = 0) if (!is(T == enum) && __traits
94
94
@trusted nothrow pure
95
95
size_t hashOf (T)(auto ref T val, size_t seed = 0 ) if (! is (T == enum ) && is (T : typeof (null )))
96
96
{
97
- return hashOf (cast (void * )null );
97
+ return hashOf (cast (void * )null , seed );
98
98
}
99
99
100
100
// Pointers hash. CTFE unsupported if not null
@@ -107,15 +107,15 @@ if (!is(T == enum) && is(T V : V*) && !is(T : typeof(null))
107
107
{
108
108
if (val is null )
109
109
{
110
- return hashOf (cast (size_t )0 );
110
+ return hashOf (cast (size_t )0 , seed );
111
111
}
112
112
else
113
113
{
114
114
assert (0 , " Unable to calculate hash of non-null pointer at compile time" );
115
115
}
116
116
117
117
}
118
- return hashOf (cast (size_t )val);
118
+ return hashOf (cast (size_t )val, seed );
119
119
}
120
120
121
121
// struct or union hash
@@ -394,6 +394,8 @@ unittest
394
394
assert(h28 == rth28);
395
395
assert(h29 == rth29);*/
396
396
assert (h30 == rth30);
397
+
398
+ assert (hashOf(null , 0 ) != hashOf(null , 123456789 )); // issue 18932
397
399
}
398
400
399
401
You can’t perform that action at this time.
0 commit comments