comp.lang.ada
 help / color / mirror / Atom feed
From: svesse <svesse@linux.nu>
Subject: Why does this happen?
Date: Wed, 16 Oct 2002 00:12:43 +0200
Date: 2002-10-16T00:12:43+02:00	[thread overview]
Message-ID: <3DAC92DB.4090307@linux.nu> (raw)

Hello,
I got a question regarding the enclosed code
which compiles on Rational Apex and on old
GNAT versions (at least on 3.11p). However
in GNAT 3.14p the following error message is
shown :

gnatmake test.adb
gcc -c test.adb
test.ads: In function `test__proc':
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
test.ads:6: prior parameter's size depends on `ns'
gnatmake: "test.adb" compilation error

if any of the two commented lines are used instead
it also compiles on GNAT 3.14p

Can someone explain why this would be illegal ?

---- test.ads ---
package test is

    Type Mtr_Type is array (Positive range <>,
                            Positive range <>) of integer;

    type T_typ (Ns : Positive) is record
       M : Mtr_Type (1..2, 1 .. ns);  -- does not compile
--      M : Mtr_Type (1..Ns, 1..Ns); -- compiles
--      M : Mtr_Type (1..Ns, 1..2);  -- compiles
    end record;

    function Func (Left : Mtr_Type) return Mtr_Type;
    procedure Proc (T : in out T_Typ);

end test;

----------

---- test.adb ----
package body test is

   function Func (Left : Mtr_Type) return Mtr_Type is
   begin
      return Left;
   end Func;

   procedure Proc(T : in out T_Typ) is
   begin
     T.M := Func(T.M);
   end Proc;
end test;
-------




             reply	other threads:[~2002-10-15 22:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-15 22:12 svesse [this message]
2002-10-16  0:46 ` Why does this happen? Dennis Lee Bieber
2002-10-16  2:25 ` tmoran
2002-10-16  6:02   ` Anders Wirzenius
2002-10-16  7:32     ` tmoran
2002-10-16 13:44       ` Frank J. Lhota
2002-10-16  5:36 ` Simon Wright
2002-10-16 15:53   ` Jerry van Dijk
2002-10-17  9:50     ` Colin Paul Gloster
2002-10-17 12:08       ` Jerry van Dijk
2002-10-16 19:56 ` Gautier
replies disabled

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