function type parameter inference not working

XavierAP via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 25 13:02:48 PDT 2017


On Tuesday, 25 April 2017 at 19:57:30 UTC, Ali Çehreli wrote:
>
> This is an intentional limitation of D. It's not possible to 
> bind rvalues (temporaries) to reference parameters. The best 
> option here is 'auto ref':

Aha I had forgotten about the ref (obviously, otherwise I 
wouldn't have passed a temporary even in the unit test -- I'm 
embarrassed). If that's the reason why it doesn't work I'm 
satisfied.

It would be helpful if the error message talked about the ref 
qualifier as the root cause instead of the consequent failure to 
infer template parameters.


More information about the Digitalmars-d-learn mailing list