digitalmars.D.bugs - [Issue 18652] New: hashOf example doesn't compile
- d-bugmail puremagic.com (33/33) Mar 23 2018 https://issues.dlang.org/show_bug.cgi?id=18652
https://issues.dlang.org/show_bug.cgi?id=18652 Issue ID: 18652 Summary: hashOf example doesn't compile Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: elpenguino+D gmail.com The example in the documentation for object.hashOf does not compile. ``` struct Test { int a; string b; MyObject c; size_t toHash() const safe pure nothrow { size_t hash = a.hashOf(); hash = b.hashOf(hash); size_t h1 = c.myMegaHash(); hash = h1.hashOf(hash); //Mix two hash values return hash; } } ``` This is entirely due to it being marked safe, while hashOf(string) is system. This example should be made into a documented unittest and corrected. --
Mar 23 2018