Error: constant false is not an lvalue

Steven Schveighoffer schveiguy at yahoo.com
Sat Aug 29 19:22:02 PDT 2009


On Sat, 29 Aug 2009 20:15:55 -0400, Ellery Newcomer  
<ellery-newcomer at utulsa.edu> wrote:

> void blah(out bool a = false){
>  // blah blah blah
> }
>
> compile time use of blah results in error.
>
> Am I doing anything wrong?

out implies a reference.  You can't have a reference to a manifest  
constant like that.

If you want to ensure a is false at the beginning of the function do:

void blah(out bool a)
{
   a = false;
   // blah blah blah
}

-Steve


More information about the Digitalmars-d-learn mailing list