View mode: basic / threaded / horizontal-split · Log in · Help
July 28, 2005
a problem with lvalues and opEquals
struct P
{
real x;

int opEquals(P v)	{return fr(v) >= 0.999999;}

static P Set(real xf)	{P ret;  ret.x=xf; return ret;}

static const P NaN =	{x:real.nan};

real fr(P v)		{return x*v.x;}

P fP(P v)
{
if(1)			// line 15
return P.NaN;	// line 16
return v;		// line 17
}

unittest
{
P X = Set(1);
assert(X.fP(X) == X);	// line 23
}
};

/***
compiled with: dmd lib/pm.d -unittest -c -inline

w/ line 15:
lib/pm.d(23): X.fP(X) is not an lvalue

w/o line 15:
no errors

I'm stumped. Should this work??
*/
July 28, 2005
Re: a problem with lvalues and opEquals
This works fine for me with DMD .128.


Sean
July 29, 2005
Re: a problem with lvalues and opEquals
In article <dcbfis$2r6p$1@digitaldaemon.com>, Sean Kelly says...
>
>This works fine for me with DMD .128.
>
>
>Sean
>
>
Linux or windows?? I'm on windows
Top | Discussion index | About this forum | D home