This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: casting and '&' both allowed in function param?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]