From: Craig Carey <research@ada95.ijs.com>
Subject: Re: class wide object in generic package
Date: Mon, 10 Jun 2002 12:28:18 GMT
Date: 2002-06-10T12:28:18+00:00 [thread overview]
Message-ID: <jr59gu8bjkl5jn804m0320h8j90sbuc24t@4ax.com> (raw)
In-Reply-To: 3D045767.8020102@rcs.ei.tum.de
On Mon, 10 Jun 2002 09:38:15 +0200, Thomas Maier-Komor
<maierkom@rcs.ei.tum.de> wrote:
...
>I am getting this error message when compiling the
>code at the end of the message:
>
>generic_pac.adb:7:26: class-wide argument not allowed here
>generic_pac.adb:7:26: "eval" is not a primitive operation of "Object"
>
...
>second: why isn't a class-wide argument not allowed
>in this place?
>
That error message is one that GNAT 3.14p for NT produces, and it
identifies the 2nd "a" in the text "eval (g.p.all)", in the
generic_pac.adb file.
Putting in a type conversion to solve the Object vs Object'Class
mismatch, causes that error to not appear. Here is GNAT listing
output:
| gnatmake generic_pac.adb -gnatl -gnatwa -gnata -gnato -gnatq -gnatf
| -v -gnatU -gnatn -g -O0 -gnaty3abcefhikrlM79pts -gnatwa -bargs -E
| -p -we -static -largs -v -v -L.
|File: generic_pac.ads
| 1. generic
| 2. type Object is abstract tagged private;
| 3. type Pointer is access all Object'class;
| 4. with procedure eval (o : in out Object);
| 5.
| 6. package generic_pac is
| 7. type gen is record
| 8. p : Pointer;
| 9. end record;
| 10.
| 11. procedure use_it (g : in out gen);
| 12.
| 13. end generic_pac;
|
|File: generic_pac.adb
| 1. with Ada.Text_IO; use Ada.Text_IO;
| 2.
| 3. package body generic_pac is
| 4. procedure use_it (g : in out gen) is
| 5. begin
| 6. Put_Line ("generic_pac.use_it");
| 7. eval (Object (g.p.all));
| 8. end use_it;
| 9. end generic_pac;
|
Craig Carey / Ada mailing lists: http://www.ijs.co.nz/ada_95.htm
next prev parent reply other threads:[~2002-06-10 12:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-10 7:38 class wide object in generic package Thomas Maier-Komor
2002-06-10 12:28 ` Craig Carey [this message]
2002-06-10 13:14 ` Thomas Maier-Komor
2002-06-10 13:00 ` Stephen Leake
2002-06-10 13:25 ` Thomas Maier-Komor
2002-06-11 20:57 ` Ehud Lamm
2002-06-12 17:33 ` Stephen Leake
2002-06-13 1:58 ` Robert A Duff
2002-06-13 14:07 ` Stephen Leake
-- strict thread matches above, loose matches on Subject: below --
2002-06-10 11:07 Grein, Christoph
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox