opDispatch forwarding and ifti

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 27 07:52:42 PST 2017


On 27.02.2017 13:14, John Colvin wrote:
> Has anyone ever found a way to actually implement forwarding properly
> with opDispatch, such that it works for both general templates and also
> functions called using ifti (implicit function template instantiation)?
>
> I've spent a day on it trying to improve std.typecons.Proxy to support
> this and it seems impossible.

One reason why your test case doesn't work is probably this compiler bug:

struct S1{
     template opDispatch(string op){
         template opDispatch(T...){
             static int x;
         }
     }
}

unittest{
     S1 s1,s2;
     alias B1 = s1.A!().x; // error
     s1.A!().x=2;          // ok
}

opDispatch seems to not be resolved when aliasing a symbol.



More information about the Digitalmars-d mailing list