comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: Unchecked_Union record inside an other record - trouble
Date: Fri, 08 Aug 2014 15:07:05 -0600
Date: 2014-08-08T15:07:05-06:00	[thread overview]
Message-ID: <%ZaFv.493734$4k2.217556@fx23.iad> (raw)
In-Reply-To: <ls3bsp$p0j$1@speranza.aioe.org>

On 08-Aug-14 14:28, Victor Porton wrote:
>
> Which compiler do you use? I suspect it is a bug in your compiler.

I'm using GNAT GPL 2013 (apparently 4.7.4)

> Or do we speak about different Ada code?

Well, given what you just posted, it looks like you renamed "T2" to 
"Container".


>    function P (C: Container) return char is
>    begin
>       return C.R.Y;
>    end;

Your Container type probably needs a tag.
Your function P should probably be something more like:

     function P (C: Container) return Character is
         Subtype Character_T is T(K => Second);
         Function Convert is new Unchecked_Conversion(
             Source => T,
             Target => Character_T
           );
     begin
         return Convert(C.R).Y; -- This ensures we get the character.
     end;


  reply	other threads:[~2014-08-08 21:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 15:36 Unchecked_Union record inside an other record - trouble Victor Porton
2014-08-08 16:01 ` Adam Beneschan
2014-08-08 16:56   ` Victor Porton
2014-08-08 18:52     ` Shark8
2014-08-08 19:56       ` Victor Porton
2014-08-08 20:06         ` Pascal Obry
2014-08-08 20:09         ` Shark8
2014-08-08 20:12           ` Victor Porton
2014-08-08 20:22             ` Shark8
2014-08-08 20:28               ` Victor Porton
2014-08-08 21:07                 ` Shark8 [this message]
2014-08-08 19:52   ` Victor Porton
2014-08-08 19:57     ` Adam Beneschan
2014-08-08 19:21 ` Per Sandberg
2014-08-08 20:01   ` Victor Porton
2014-08-08 21:23   ` Jeffrey Carter
2014-08-10  7:25     ` Per Sandberg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox