comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier <gautier@fakeaddress.nil>
Subject: Re: Using a generic instance to implement a public subprogram?
Date: Sun, 03 Feb 2008 20:27:52 +0100
Date: 2008-02-03T20:27:52+01:00	[thread overview]
Message-ID: <47a615cc$1_4@news.bluewin.ch> (raw)
In-Reply-To: <47a609b8$0$23664$4d3efbfe@news.sover.net>

Peter C. Chapin:

...
> GNAT says this:
> 
> check.adb:3:14: missing body for "Sqrt" declared at check.ads:5
> check.adb:21:13: "Sqrt" conflicts with declaration at check.ads:5
> check.adb:21:13: instantiation cannot provide body for it
> 
> The first message I understand. The last two I'm not clear about. Is 
> GNAT telling me that my declarations conflict in some way and because of 
> that it can't do the instantiation, or is the instantiation the *cause* 
> of the conflict? Is it possible to do what I'm trying to do here?

No idea whether GNAT is right or not, but the following works (I came across the 
same problem at least one time...):

    function Sqrt_internal is
       new Unary_Operation(Operation => Elementary_Functions.Sqrt);

    function Sqrt(V : Vector) return Vector
       renames Sqrt_internal;

Note that the compilation of your code with ObjectAda 7.2.2 fails too; it says 
the following:
"
check.adb: Error: line 21 col 13 LRM:8.3(26), Illegal to override declaration in 
same region, Introducing new declaration anyway

check.adb: Error: line 27 col 1 LRM:3.11.1(6), Completion required for 
specification 'Sqrt', Continuing

Front end of ..\..\check.adb failed with 2 errors.
"
______________________________________________________________
Gautier         -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



  reply	other threads:[~2008-02-03 19:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 18:35 Using a generic instance to implement a public subprogram? Peter C. Chapin
2008-02-03 19:27 ` Gautier [this message]
2008-02-03 19:46   ` Peter C. Chapin
2008-02-03 20:37     ` Dmitry A. Kazakov
2008-02-05  1:58 ` Randy Brukardt
replies disabled

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