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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, T_FILL_THIS_FORM_SHORT,WEIRD_PORT,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d58fe1ff04da7fd7,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-14 08:25:09 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!psinet-eu-nl!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Ambiguous reference - What is wrong with this? Date: Tue, 14 Aug 2001 11:14:30 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9lbf8n$brf$1@nh.pace.co.uk> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 997802071 12143 136.170.200.133 (14 Aug 2001 15:14:31 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 14 Aug 2001 15:14:31 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:11920 Date: 2001-08-14T15:14:31+00:00 List-Id: O.K. I've got a compilation problem that is most likely due to my misunderstanding of some language rule. Below is some code that shows a simplified version of the problem. I'm using Gnat 3.13p on a WinNT PC. I'm pretty sure that the problem has something to do with the 'Class parameters creating some kind of ambiguity - but given that I've fully qualified the names, it seems like the compiler ought to know which procedure I meant to call. The quest6ion is twofold: Am I doing something illegal (if so, what?) and if it *is* illegal, then is there an alternate way of doing essentially the same thing? (One parameter being of a specific descendent and the other being a class-wide parameter. The class wide parameter wants to be an increasingly restrictive subset as you move down the chain of child packages) package Root is type Base is tagged private ; procedure Some_Proc ( Object : in out Base; Object2 : in out Base'Class) ; private type Base is tagged record Data_Item_1 : Natural := 0 ; end record ; end Root ; package body Root is procedure Some_Proc ( Object : in out Base; Object2 : in out Base'Class) is begin null ; end Some_Proc ; end Root ; package Root.Child1 is type Derive1 is new Base with private ; procedure Some_Proc ( Object : in out Derive1; Object2 : in out Derive1'Class) ; private type Derive1 is new Base with record Data_Item_2 : Natural := 0 ; end record ; end Root.Child1 ; package body Root.Child1 is procedure Some_Proc ( Object : in out Derive1; Object2 : in out Derive1'Class) is begin Root.Some_Proc ( Object => Root.Base (Object), Object2 => Object2) ; end Some_Proc ; end Root.Child1 ; package Root.Child1.Child2 is type Derive2 is new Derive1 with private ; procedure Some_Proc ( Object : in out Derive2; Object2 : in out Derive2'Class) ; private type Derive2 is new Derive1 with record Data_Item_3 : Natural := 0 ; end record ; end Root.Child1.Child2 ; package body Root.Child1.Child2 is procedure Some_Proc ( Object : in out Derive2; Object2 : in out Derive2'Class) is begin -- -- Dies here with the following error message: -- -- root-child1-child2.adb:15:20: ambiguous expression (cannot resolve "Some_Proc") -- root-child1-child2.adb:15:20: possible interpretation at root-child1.ads:4 -- root-child1-child2.adb:15:20: possible interpretation at root-child1.ads:3 -- gnatmake: "root-child1-child2.adb" compilation error -- Root.Child1.Some_Proc ( Object => Root.Child1.Derive1 (Object), Object2 => Object2) ; end Some_Proc ; end Root.Child1.Child2 ; Thanks for any help you can offer. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/