Bug 8153 – Warning about toHash signature is incorrect on x86_64
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2012-05-26T15:05:00Z
Last change time
2015-06-09T05:15:02Z
Assigned to
nobody
Creator
issues.dlang
Comments
Comment #0 by issues.dlang — 2012-05-26T15:05:26Z
Comment #1 by issues.dlang — 2012-05-26T15:09:58Z
Sorry, I accidentally hit enter. Here's the bug description:
------------------------------------------------------------
This code:
struct S
{
size_t toHash() const pure
{
return 42;
}
string val;
}
void main()
{
}
results in this error with -w:
q.d(3): Warning: toHash() must be declared as extern (D) uint toHash() const nothrow @safe, not const pure ulong()
The _correct_ signature for toHash is
size_t toHash() @safe const pure nothrow
The warning incorrectly lists uint. It should say size_t. It should probably also say pure, but that might not be required yet given the flux that toHash, toString, opEquals, et al. are in at the moment with regards to their required attributes.
Comment #2 by github-bugzilla — 2012-11-28T00:46:57Z