comp.lang.ada
 help / color / mirror / Atom feed
From: Yves Bailly <kafka.fr@laposte.net>
Subject: Re: Casting from interface type
Date: Fri, 28 Jul 2006 07:46:08 +0200
Date: 2006-07-28T07:46:11+02:00	[thread overview]
Message-ID: <44c9a4a3$0$691$626a54ce@news.free.fr> (raw)
In-Reply-To: 1154050141.462907.39690@b28g2000cwb.googlegroups.com

Adam Beneschan wrote:

>> 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
> 
> Type T is not descended from I, so there cannot be any object in
> I'Class that has type T.

This makes sense to me?

> However, the following should be legal, 
> although GNAT probably won't accept it (see below):
> 
>     var_t := T (T'Class (p));
> 
>> proc.adb:15:21: invalid tagged conversion, not compatible with
>> type "I'Class" defined at line 3
> 
> I think this is legal and GNAT is wrong.  My printed copy of
> 4.6(23.1/2) says that type conversions between *any* two class-wide
> types are legal if one of them has an interface type as its specific
> type, even if the other one doesn't have an interface ancestor, because
> some type in the class *could* have an interface ancestor (as DT does
> in your example).  I tried to check to make sure this section hasn't
> changed since I printed it, but unfortunately www.adaic.com is down
> right now.

Just checked, it hasn't changed since when I downloaded it. This is
this precise clause which made me wondering if I misunderstood
something. Well, maybe I'll fill a bug report...

Thanks for your help.

Regards,

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



  reply	other threads:[~2006-07-28  5:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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