www.digitalmars.com         C & C++   DMDScript  

D - 'new foo' is not an l-value

reply "Jon Allen" <jallen minotstateu.edu> writes:
I think I found a compiler bug.  The commented line doesn't work, but the
following two do.  This doesn't seem right.  Am I missing something here?

class foo
{}

void main()
{
    foo* bar;
    foo blah;
    //bar=&(new foo);
    blah=new foo;
    bar=&blah;

}
Mar 27 2003
parent "Walter" <walter digitalmars.com> writes:
"Jon Allen" <jallen minotstateu.edu> wrote in message
news:b60ke6$31gj$1 digitaldaemon.com...
 I think I found a compiler bug.  The commented line doesn't work, but the
 following two do.  This doesn't seem right.  Am I missing something here?

 class foo
 {}

 void main()
 {
     foo* bar;
     foo blah;
     //bar=&(new foo);
     blah=new foo;
     bar=&blah;

 }
Think of it as analogous to: bar = &(x + y); as opposed to: blah = (x + y); bar = &blah;
May 16 2003