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:45:57 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!news-peer-west.sprintlink.net!news.sprintlink.net!newsfeed.direct.ca!look.ca!news1.tor.metronet.ca!nnrp1.tor.metronet.ca!not-for-mail Message-ID: <3B7963D5.A7E01D5@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> <3B795848.9DAFEE53@home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 14 Aug 2001 17:45:57 GMT NNTP-Posting-Host: 198.96.47.195 NNTP-Posting-Date: Tue, 14 Aug 2001 11:45:57 MDT Organization: MetroNet Communications Group Inc. Xref: archiver1.google.com comp.lang.ada:11929 Date: 2001-08-14T17:45:57+00:00 List-Id: Replying further to this post with new information.. "Warren W. Gay VE3WWG" wrote: > > 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. The AONIX compiler faults the same lines, with the message: ... LRM 8.6(31) Ambiguous call, possible definitions of Some_Proc appear at line 3 of root-child1.ads, line 4 (same file). I havn't had time to look at this in detail yet, but LRM 8.6 reports: 8.6 The Context of Overload Resolution (31) A complete context other than a pragma_argument_association shall not be ambiguous. I'd have to study this whole section to make sense of this error. 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 -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg