comp.lang.ada
 help / color / mirror / Atom feed
From: Yves Bailly <kafka.fr@laposte.net>
Subject: Casting from interface type
Date: Fri, 28 Jul 2006 00:42:43 +0200
Date: 2006-07-28T00:42:46+02:00	[thread overview]
Message-ID: <44c94166$0$11790$626a54ce@news.free.fr> (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 | //\
\_/ |                                      | \_/`



             reply	other threads:[~2006-07-27 22:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-27 22:42 Yves Bailly [this message]
2006-07-28  1:29 ` Casting from interface type 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
replies disabled

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