The following code prints:

/home/c494/c719.d(27): Error: (Vec2!(float) __ctmp1173 = _D4c71911__T4Vec2TfZ4Vec26__initZ;
, __ctmp1173).this(4F, 2F) is not an lvalue

[code]
import std.stdio;

struct Vec2(T) {
public:
        T x;
        T y;
        
        this(T x, T y) {
        
        }
}

alias Vec2f = Vec2!(float);

class Foo {
public:
        static Foo make(float i, ref const Vec2f a) {
                return new Foo();
        }
        
        static Foo make(float i, const Vec2f a) {
                return Foo.make(i, a);
        }
}

void main() {
        Foo f = Foo.make(42, Vec2f(4, 2));
}
[/code]

If I change i from float to int it works. Also if I write 42f instead of 42. That is strange. Could someone explain me that?

Same with this code: http://dpaste.1azy.net/2c98fe95
But there I found no workaround.

Reply via email to