I reopened Bug 7815 because I found a new test case where it still doesn't work even in the latest beta.
http://d.puremagic.com/issues/show_bug.cgi?id=7815 On Sat, Apr 7, 2012 at 6:14 PM, Walter Bright <[email protected]>wrote: > > > On 4/7/2012 2:21 PM, Nick Sabalausky wrote: > >> From: "Nick Sabalausky" <[email protected]> >> >>> While the test case for #7826 now works, for some reason I'm still >>> getting the same warning in my own projects (but without "pure" being >>> included in "must be declared as...") even though they which use the >>> *exact* same toHash function (well, except "str" having a different name). >>> I'll try to figure out a new test case after I get some sleep... >>> >>> >> /facepalm: With Beta2, I wasn't getting the probelem with the original >> test case (ie "const hash_t toHash()") because I wasn't compiling it with >> warnings enabled. >> >> So here's the "issue" now, *if* it even is an issue (I'm not sure): >> >> With Beta2's current fix for #7826, I can do this without warnings or >> errors: >> >> struct Foo { >> string str; >> const nothrow @safe hash_t toHash() { >> return typeid(string).getHash(&str); >> } >> } >> >> But, this (ie, removing nothrow and/or @safe): >> >> struct Foo { >> string str; >> const hash_t toHash() { >> return typeid(string).getHash(&str); >> } >> } >> >> Gives me a warning: >> >> Warning: toHash() must be declared as extern (D) uint toHash() const >> nothrow @safe, not const uint() >> >> Is this the correct behavior or not? Jonathan's comment over here ( >> http://d.puremagic.com/issues/**show_bug.cgi?id=7826<http://d.puremagic.com/issues/show_bug.cgi?id=7826>) >> suggested that toHash in a struct shouldn't require nothrow or @safe. I'm >> refraining from having any opinion on the matter ATM, I just wanted to >> bring it up in case the current fix is incomplete. >> >> > It's correct behavior. We're moving towards const/pure/nothrow/@safe for > all those functions. > > ______________________________**_________________ > dmd-beta mailing list > [email protected] > http://lists.puremagic.com/**mailman/listinfo/dmd-beta<http://lists.puremagic.com/mailman/listinfo/dmd-beta> >
_______________________________________________ dmd-beta mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-beta
