I dun a DIP, possibly the best DIP ever

Stefan Koch uplink.coder at googlemail.com
Fri Apr 24 08:52:41 UTC 2020


On Friday, 24 April 2020 at 08:35:53 UTC, Walter Bright wrote:
> On 4/24/2020 1:24 AM, Walter Bright wrote:
>
> Please keep in mind that the following works today:
>
>   void foo(int);
>
>   template tuple(T...) { enum tuple = T; }
>
>   void test() {
>     auto t = tuple!(1, 2, 3);
>     static foreach (i, e; t)
>         foo(e + i);
>   }
>
> and generates:
>
>   void test() {
>      foo(1); foo(3); foo(5);
>   }

not on 64bit.
on 64bit it's cannot pass argument cast(ulong)__t_field_0 + 0LU 
of type ulong to parameter int.
on 32 bit it genrates
     (int, int, int) t = tuple(1, 2, 3);
     foo(cast(ulong)__t_field_0 + 0LU);
     foo(cast(ulong)__t_field_1 + 1LU);
     foo(cast(ulong)__t_field_2 + 2LU);




More information about the Digitalmars-d mailing list