comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@home.com>
Subject: Re: Ambiguous reference - What is wrong with this?
Date: Tue, 14 Aug 2001 17:45:57 GMT
Date: 2001-08-14T17:45:57+00:00	[thread overview]
Message-ID: <3B7963D5.A7E01D5@home.com> (raw)
In-Reply-To: 3B795848.9DAFEE53@home.com

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



  reply	other threads:[~2001-08-14 17:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-14 15:14 Ambiguous reference - What is wrong with this? Marin David Condic
2001-08-14 16:56 ` Warren W. Gay VE3WWG
2001-08-14 17:45   ` Warren W. Gay VE3WWG [this message]
2001-08-14 17:54   ` Marin David Condic
2001-08-14 19:24     ` Warren W. Gay VE3WWG
2001-08-14 17:44 ` Sergey Koshcheyev
2001-08-14 20:10   ` Marin David Condic
2001-08-15  7:38     ` Sergey Koshcheyev
2001-08-15 13:49       ` Marin David Condic
2001-08-14 20:02 ` tmoran
2001-08-15  6:17   ` Simon Wright
2001-08-17 16:34     ` Marin David Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox