comp.lang.ada
 help / color / mirror / Atom feed
* Casting from interface type
@ 2006-07-27 22:42 Yves Bailly
  2006-07-28  1:29 ` Adam Beneschan
  2006-07-28  4:32 ` Jeffrey R. Carter
  0 siblings, 2 replies; 5+ messages in thread
From: Yves Bailly @ 2006-07-27 22:42 UTC (permalink / raw)


Hello all,

Please consider this small code :
--8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<---
procedure Proc is
   type I is interface;
   type T is tagged null record;
   type DT is new T and I with null record;

   var_t: T;
   var_tc: T'Class := var_t;

   procedure Conv(p: in I'Class) is
   begin
      if p in T'Class
      then
         var_t := T(p);
         var_tc := T'Class(p);
      end if;
   end Conv;

   var_dt: DT;

begin

   Conv(var_dt);

end Proc;
--8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<---

Using the latest GNAT 2006, I receive the following errors:
proc.adb:14:19: invalid tagged conversion, not compatible with
type "I'Class" defined at line 3
proc.adb:15:21: invalid tagged conversion, not compatible with
type "I'Class" defined at line 3

Please, can someone tell me what am I doing wrong ?

Thanks in advance for your time.

Best regards,

-- 
(o< | Yves Bailly  : http://kafka-fr.net   | -o)
//\ | Linux Dijon  : http://www.coagul.org | //\
\_/ |                                      | \_/`



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-07-28 12:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-27 22:42 Casting from interface type Yves Bailly
2006-07-28  1:29 ` Adam Beneschan
2006-07-28  5:46   ` Yves Bailly
2006-07-28 12:06     ` Javier Miranda - jmiranda
2006-07-28  4:32 ` Jeffrey R. Carter

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