comp.lang.ada
 help / color / mirror / Atom feed
From: Thierry&Annick <tajz@libertysurf.fr>
Subject: GNAT Error message
Date: Sun, 17 Dec 2000 19:11:54 +0100
Date: 2000-12-17T21:20:26+00:00	[thread overview]
Message-ID: <3A3D01EA.37CB440B@libertysurf.fr> (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 ?






             reply	other threads:[~2000-12-17 18:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-17 18:11 Thierry&Annick [this message]
2000-12-18  0:56 ` GNAT Error message 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
replies disabled

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