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,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d58fe1ff04da7fd7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-14 10:03:33 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news1.tor.metronet.ca!nnrp1.tor.metronet.ca!not-for-mail Message-ID: <3B795848.9DAFEE53@home.com> From: "Warren W. Gay VE3WWG" X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ambiguous reference - What is wrong with this? References: <9lbf8n$brf$1@nh.pace.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 14 Aug 2001 16:56:42 GMT NNTP-Posting-Host: 198.96.47.195 NNTP-Posting-Date: Tue, 14 Aug 2001 10:56:42 MDT Organization: MetroNet Communications Group Inc. Xref: archiver1.google.com comp.lang.ada:11926 Date: 2001-08-14T16:56:42+00:00 List-Id: Marin David Condic wrote: > > 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 tried this out under HPUX 11.0, using gnat 3.12p, and got precisely the same results.. Your code looks to me like it should compile OK, and in fact I was expecting to use the same technique someday soon. But maybe my understanding of this situation is not complete. It seems that the compiler is confused between the Base object's Root.Some_Proc procedure, and the Root.Child1.Some_Proc, because of the message : root-child1-child2.adb:15:20: possible interpretation at root-child1.ads:3 which seems odd. Line 3 is singled out in the message where you derive the type from Base. This to me does not make sense, since all seems to be pretty clear about what the dispatch should be. I even made all of your tagged records non-private, and got the same results. I guess I can't help, or its a bug. Good luck, Warren. > 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/ -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg