This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] for PR 18040
* Jason Merrill:
> On Mon, 18 Oct 2004 14:33:03 +0200, Florian Weimer <fw@deneb.enyo.de> wrote:
>
>> Unfortunately, var doesn't have to be addressable.
>
> If var isn't addressable, there's no way to break up references into
> multiple statements, because there's no way to get a handle on an
> intermediate reference. So it seems that we need to support
> VIEW_CONVERT_EXPR (but not NOP_EXPR) inside references.
>
> If var is addressable, uses of VIEW_CONVERT_EXPR can be broken up into
> pointer casts.
The language permits to work on an addressable copy instead, but
previous GNAT versions seem to behave differently and return a
reference to the argument in Unchecked_Conversion, be it addressable
or not. Although it's not documented explicitly in the GNAT RM, this
behavior must be preserved because some real-world code is likely to
rely on it. At least that's my gut feeling, someone at AdaCore should
know better.