Skip to content

Commit

Permalink
Merge pull request #8175 from n8sh/issue-18767-xtoHash
Browse files Browse the repository at this point in the history
Fix Issue 18767 - __xtoHash memberwise hashing shouldn't just sum the member hashes
merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Apr 17, 2018
2 parents 9565024 + 2f13c2d commit f4c0c65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dmd/clone.d
Expand Up @@ -765,7 +765,7 @@ extern (C++) FuncDeclaration buildXtoHash(StructDeclaration sd, Scope* sc)
const(char)* code =
"size_t h = 0;" ~
"foreach (i, T; typeof(p.tupleof))" ~
" h += typeid(T).getHash(cast(const void*)&p.tupleof[i]);" ~
" h = h * 33 + typeid(T).getHash(cast(const void*)&p.tupleof[i]);" ~
"return h;";
fop.fbody = new CompileStatement(loc, new StringExp(loc, cast(char*)code));
Scope* sc2 = sc.push();
Expand Down

0 comments on commit f4c0c65

Please sign in to comment.