Thread overview
[dmd-beta] D 1.074 and 2.059 betas 2
Apr 07, 2012
Walter Bright
Apr 07, 2012
Nick Sabalausky
Apr 07, 2012
Nick Sabalausky
Apr 07, 2012
Walter Bright
Apr 08, 2012
David Simcha
April 06, 2012
http://ftp.digitalmars.com/dmd1beta.zip
http://ftp.digitalmars.com/dmd2beta.zip
_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 07, 2012
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...

_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 07, 2012
From: "Nick Sabalausky" <bus_dmdbeta@semitwist.com>
> 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 ) 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.

_______________________________________________
dmd-beta mailing list
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 07, 2012

On 4/7/2012 2:21 PM, Nick Sabalausky wrote:
> From: "Nick Sabalausky" <bus_dmdbeta@semitwist.com>
>> 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 ) 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
dmd-beta@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-beta

April 07, 2012
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 <walter@digitalmars.com>wrote:

>
>
> On 4/7/2012 2:21 PM, Nick Sabalausky wrote:
>
>> From: "Nick Sabalausky" <bus_dmdbeta@semitwist.com>
>>
>>> 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
> dmd-beta@puremagic.com
> http://lists.puremagic.com/**mailman/listinfo/dmd-beta<http://lists.puremagic.com/mailman/listinfo/dmd-beta>
>