comp.lang.ada
 help / color / mirror / Atom feed
* type mismatches/access type
@ 2001-03-04 20:35 Frank
  2001-03-04 20:43 ` Additional info for the message above: for Linux/RedHat6.2/Gnat3.13 Frank
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Frank @ 2001-03-04 20:35 UTC (permalink / 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
....
...
...





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-03-08  6:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-04 20:35 type mismatches/access type Frank
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

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