comp.lang.ada
 help / color / mirror / Atom feed
* GNAT Error message
@ 2000-12-17 18:11 Thierry&Annick
  2000-12-18  0:56 ` Robert Dewar
  2000-12-19 15:56 ` Tucker Taft
  0 siblings, 2 replies; 9+ messages in thread
From: Thierry&Annick @ 2000-12-17 18:11 UTC (permalink / raw)


Consider the following (incorrect) code "test.ada" :

generic
  type Index_Type is (<>);
package Generic_Array is
  type Instance_Type is array (Index_Type) of Integer;
  procedure Fill (This : out Instance_Type);
end Generic_Array;

package body Generic_Array is
  procedure Fill (This : out Instance_Type) is
  begin
    for Index in Index_Type loop
      This (Index) := Integer (Index - This'First);   -- Line 13
    end loop;
  end Fill;
end Generic_Array;

with Generic_Array;
procedure Check is
  type Int_Type is range 0 .. 10;
  package Int_Array is new Generic_Array (Int_Type);
begin
  null;
end Check;


The GNAT error message after gnatchop'ed (gnatchop -q -r -w) is :
test.ada:13:38: invalid operand types for operator "-"
test.ada:13:38: left operand has type "Index_Type" defined at test.ada:2

test.ada:13:38: right operand has type "Index_Type" defined at
test.ada:2
gnatmake: "check.adb" compilation error

Ok, my fault : Index_Type should be "range <>" to have a "-" operator,
but the error message is not clear.
Anybody knows what will this message be with others compilers ?






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

end of thread, other threads:[~2000-12-20 20:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-17 18:11 GNAT Error message Thierry&Annick
2000-12-18  0:56 ` Robert Dewar
2000-12-18 21:58   ` Thierry&Annick
2000-12-19  2:23     ` Ken Garlington
2000-12-19 15:37     ` Robert Dewar
2000-12-19 15:56 ` Tucker Taft
2000-12-20  0:38   ` Robert Dewar
2000-12-20 17:44     ` Larry Kilgallen
2000-12-20 20:36       ` Robert Dewar

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