endless loop with ref and non-ref parameter

Namespace rswhite4 at googlemail.com
Sun Jan 27 12:25:17 PST 2013


> no match
> match with im­plicit con­ver­sions
> match with con­ver­sion to const
> exact match

Explain me, why this code prints:

Error: A() is not an lvalue

[code]
import std.stdio;

struct A { }

void foo(A a, float r) {
	
}

void foo(const A a, float r) {

}

void foo(ref A a, float r) {
	
}

void main()
{
    foo(A(), 12);
}
[/code]

Why is the ref A a functions chosen?
I create already a pull request but a explanation would be nice.


More information about the Digitalmars-d-learn mailing list