Error: constant false is not an lvalue

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 31 12:03:53 PDT 2009


On Mon, 31 Aug 2009 14:55:43 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

>
> It's possible that something like what you wrote could work (although  
> I'd write it foo(ref int i = j)).

In fact, it does work, in D1 no less.

# cat testme.d
import tango.io.Stdout;

int j;
void foo(ref int i = j)
{
     i++;
}

void main()
{
     int i = 4;
     foo();
     foo(i);
     Stdout(i, j).newline;
}
# dmd testme.d
# ./testme
5, 1


-Steve


More information about the Digitalmars-d-learn mailing list