casting and '&' both allowed in function param?

Alexandre Oliva aoliva@redhat.com
Tue Aug 8 17:57:00 GMT 2000


On Aug  7, 2000, Andy Grover <andrew.grover@intel.com> wrote:

> I am using gcc 2.95 and it's emitting the message: "invalid lvalue in
> unary '&'" on the following function call:

>                  &((NAMED_OBJECT *)Region));

> The last line works under VC.

VC is wrong.  The result of a cast is an rvalue.  As an extension, GCC
accepts the result of a cast as an lvalue, but it won't allow you to
take its address.  See `info "(gcc.info)Lvalues"'

> Is this a case where VC is overly accepting, or is this actually a
> bug in GCC?

It's a bug in VC.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me



More information about the Gcc-bugs mailing list