structs are now lvalues - what is with "auto ref"?

Namespace rswhite4 at googlemail.com
Sun Dec 30 05:57:25 PST 2012


> I've played with this a bit today. The code is at 
> https://github.com/jerro/dmd/tree/auto-ref. I know next to 
> nothing about DMD, so it could be all kinds of wrong, but it 
> does at least seem to work.
>
> What do you think should happen in this case:
>
> void foo(auto ref int a){}
> void foo(int a){}
> ...
> foo(1);
>
> should this be an error, or should the second overload be 
> called?

IMO the second overload (foo(int a)) should be called and the 
compiler shouldn't do anymore, because all necessary functions 
exists.

> And what about this:
>
> void foo(auto ref int a){}
> void foo(ref int a){}

IMO the auto ref function should be replaced by void foo(int a){ 
}. Then all necessary functions exists also.

Nice work so far, but I don't see any tests for it.
I hope it will be merged in this release.


More information about the Digitalmars-d-learn mailing list