http://d.puremagic.com/issues/show_bug.cgi?id=7826

           Summary: [D2 Beta] Cannot use getHash in toHash without a
                    warning
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: cbkbbej...@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbej...@mailinator.com> 2012-04-05 
02:25:46 PDT ---
This code works in 2.058, even with warnings enabled:

------------------------
struct Foo
{
    string str;

    const hash_t toHash()
    {
        return typeid(string).getHash(&str);
    }
}
------------------------

But in the 2.059 beta:

>dmd -c -w test.d
test.d(5): Warning: toHash() must be declared as extern (D) uint toHash() const
pure nothrow @safe, not const uint()

However, if the warning is is fixed, it *still* doesn't work:

------------------------
struct Foo
{
    string str;

    const pure nothrow @safe hash_t toHash()
    {
        return typeid(string).getHash(&str);
    }
}
------------------------

testToHash.d(7): Error: pure function 'toHash' cannot call impure function
'getHash'
testToHash.d(7): Error: & D12TypeInfo_Aya6__initZ.getHash is not nothrow
testToHash.d(5): Error: function testToHash.Foo.toHash 'toHash' is nothrow yet
may throw

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to