Bug 19009 – core.internal.hash.hashOf default hash (absent `toHash`) should be `@nogc`

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-20T16:21:29Z
Last change time
2018-07-02T18:44:55Z
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2018-06-20T16:21:29Z
The default `hashOf` implementation used for types that do not have `toHash` uses `toUbyte` to get the byte representation which during CTFE requires allocation but during execution does not. The compiler currently takes CTFE-only code into account when inferring attributes but we can give it some help.
Comment #1 by n8sh.secondary — 2018-06-20T16:34:27Z
Comment #2 by github-bugzilla — 2018-06-21T17:02:40Z
Commits pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/4f5b049559d69c9c696c6534302ecbcff30126d5 Fix Issue 19009 - core.internal.hash.hashOf default hash (absent `toHash`) should be `@nogc` https://github.com/dlang/druntime/commit/753239f81180bee1bbd62cdbaaa7d2564fee3f3f Merge pull request #2228 from n8sh/hash-nogc Fix Issue 19009 - core.internal.hash.hashOf default hash (absent `toHash`) should be `@nogc` merged-on-behalf-of: Steven Schveighoffer <[email protected]>
Comment #3 by n8sh.secondary — 2018-07-02T18:44:55Z
*** Issue 16293 has been marked as a duplicate of this issue. ***