comp.lang.ada
 help / color / mirror / Atom feed
From: "Frank" <franjoe@frisurf.no>
Subject: type mismatches/access type
Date: Sun, 4 Mar 2001 21:35:09 +0100
Date: 2001-03-04T21:35:09+01:00	[thread overview]
Message-ID: <wKxo6.7148$t21.173574@news3.oke.nextra.no> (raw)

Hi!

I have downloaded the source code for the ADEPT projekt (on AdaPower
w-page).
There is a package  that is a part of the "jxtrans" program
in there that I get a compilation error on, code snippet (of what I believe
is
important :-) follows:
The compiler is very frustrated by the use of the "=" operator and

the error message is as follows:

gnatgcc -c -gnatf jxt_list.adb
jxt_list.adb:26:19: invalid operand types for operator "="
jxt_list.adb:26:19: left operand has type access to "Element_T'Class"
defined at jxt_list.ads:23
jxt_list.adb:26:19: right operand has an access type
jxt_list.adb:33:26: expected type "Element_p" defined at jxt_list.ads:21
jxt_list.adb:33:26: found type access to "Element_T'Class" defined at
jxt_list.ads:23
jxt_list.adb:34:26: expected type "Element_p" defined at jxt_list.ads:21
jxt_list.adb:34:26: found type access to "Element_T'Class" defined at
jxt_list.ads:23
jxt_list.adb:38:31: expected type "Element_p" defined at jx......
asf on several places.

I have tried to replace the use of "access Element_t'Class;"
in the package and used the "Element_p" instead. Then this package compiles,
but then another package depending on this one get in trouble instead.


Is there some way to convince the compiler that Element can be "null"?
or does anyone have a suggestion as to why I get this error; after all,
the package has compiled on Solaris...



spec part
....
...
   type Element_t is tagged private;
   type Element_p is access all Element_t'class;

   procedure Add (Element : access Element_t'Class;
                  List : List_p);
   procedure Remove (Element : access Element_t'Class);


body part:

package body JxT_List is

   ----------------------------
   -- Add                    --
   ----------------------------
   --  Public
   --  Adds an element to a list.
   --
   procedure Add (Element : access Element_t'Class;
                  List : List_p) is
   begin
      if (Element = null) then     <-----------------Compiler reports error
ln:26
         null;
      else
         if (Element.List /= null) then
            Remove (Element);
         end if;
         if (List.Num_Elems = 0) then
            List.Head := Element;  <--------------Compiler reports error
ln:33
            List.Tail := Element;
            Element.Next := null;
            Element.Prev := null;
         else
....
...
...





             reply	other threads:[~2001-03-04 20:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-04 20:35 Frank [this message]
2001-03-04 20:43 ` Additional info for the message above: for Linux/RedHat6.2/Gnat3.13 Frank
2001-03-07 21:55 ` Still open for suggestions :-) Frank
2001-03-07 23:38 ` type mismatches/access type Mark Lundquist
2001-03-08  6:24   ` Frank
replies disabled

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