http://d.puremagic.com/issues/show_bug.cgi?id=3167



--- Comment #15 from Eldar Insafutdinov <e.insafutdi...@gmail.com> 2010-02-07 
03:05:52 PST ---
(In reply to comment #13)
> It is invalid code because you are taking a reference to the return value of a
> function. Functions return, by definition, rvalues. You cannot take a 
> reference
> to an rvalue.

But it used to work before.

Just simple case, that I encountered today (I'm sure many of us had similar
experience(:

struct vec3d
{
    double x,y,z;
    static vec3d opCall(double x, double y, double z) { ... }
}

vec3d vecMul(ref const vec3d a, ref const vec3d b)
{
...
}

void main()
{
    vec3d a;
    ...
    vec3d b = opMul(a, vec3d(0., 0., 1.); // doesn't work because opCall
returns rvalue
}

I don't see anything wrong with this code, as const protects arguments from
being modified.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to