issue with each specifically for x86

ag0aep6g anonymous at example.com
Wed Mar 7 20:09:45 UTC 2018


On 03/07/2018 08:54 PM, Steven Schveighoffer wrote:
> Looking at each, it looks like it does this:
> 
> cast(void) unaryFun!pred(r.front);
> 
> So I tried this:
> 
> auto pred = i => a[i] = a[i-1] + 2;
> foreach(i; 1 .. a.length)
>     cast(void)pred(i);
> 
> And I see the -nan value. Remove the cast(void) and I don't see it.
> 
> Clearly there is some codegen issue here.

It's beautiful:

----
double f() { return 1; }

void main()
{
     cast(void) f();
     cast(void) f();
     cast(void) f();
     cast(void) f();
     cast(void) f();
     cast(void) f();
     cast(void) f();

     double b = 2;
     assert(b == 2); /* fails; should pass */
}
----


More information about the Digitalmars-d-learn mailing list