[Issue 3167] Passing result of a function call as ref argument no longer works
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 7 03:05:53 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3167
--- Comment #15 from Eldar Insafutdinov <e.insafutdinov at 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: -------
More information about the Digitalmars-d-bugs
mailing list