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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc3e3a6e4f85e03f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-10 05:29:45 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!novia!novia!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin7.nnrp.aus1.giganews.com.POSTED!news.clear.net.nz From: Craig Carey Newsgroups: comp.lang.ada Subject: Re: class wide object in generic package Message-ID: References: <3D045767.8020102@rcs.ei.tum.de> X-Newsreader: Forte Agent 1.9/32.560 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: Customer of Mercury Telecommunications Ltd Cache-Post-Path: drone4.qsi.net.nz!unknown@tnt1-224.quicksilver.net.nz X-Cache: nntpcache 2.4.0b2 (see http://www.nntpcache.org/) X-Original-NNTP-Posting-Host: drone4-svc-skyt.qsi.net.nz X-Original-Trace: 11 Jun 2002 00:28:15 +1200, drone4-svc-skyt.qsi.net.nz NNTP-Posting-Date: Mon, 10 Jun 2002 07:28:17 CDT X-Trace: sv3-XXSHA8l+mYVu74asu+EtQxF0z5HALHm3XS/hvK3MKKAy1Gnu3La5RwrH8GLW+TLTWqLaYiinvMvIqKe!ERxMpC00/g4ZJzcjgUfhGcWo1PI9QVx663Bdub4GJWxJRYm+WMXLXICHZFwNtXj+Zx5icVBDV0a0!WEApWQ== X-Complaints-To: abuse@GigaNews.Com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly Date: Mon, 10 Jun 2002 12:28:18 GMT Xref: archiver1.google.com comp.lang.ada:25661 Date: 2002-06-10T12:28:18+00:00 List-Id: On Mon, 10 Jun 2002 09:38:15 +0200, Thomas Maier-Komor 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