From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,86c76377d1077f30 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad.net!cleanfeed1-b.proxad.net!nnrp11-2.free.fr!not-for-mail Message-ID: <44c9a4a3$0$691$626a54ce@news.free.fr> From: Yves Bailly Subject: Re: Casting from interface type Newsgroups: comp.lang.ada Date: Fri, 28 Jul 2006 07:46:08 +0200 References: <44c94166$0$11790$626a54ce@news.free.fr> <1154050141.462907.39690@b28g2000cwb.googlegroups.com> User-Agent: KNode/0.10.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Organization: Guest of ProXad - France NNTP-Posting-Date: 28 Jul 2006 07:46:11 MEST NNTP-Posting-Host: 81.56.171.53 X-Trace: 1154065571 nnrp11-2.free.fr 691 81.56.171.53:38197 X-Complaints-To: abuse@proxad.net Xref: g2news2.google.com comp.lang.ada:5979 Date: 2006-07-28T07:46:11+02:00 List-Id: 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 | //\ \_/ | | \_/`