This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: casting and '&' both allowed in function param?
- To: Andy Grover <andrew dot grover at intel dot com>
- Subject: Re: casting and '&' both allowed in function param?
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 08 Aug 2000 21:57:05 -0300
- Cc: gcc-bugs at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <398F507E.5329056E@intel.com>
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