comp.lang.ada
 help / color / mirror / Atom feed
* Why does this happen?
@ 2002-10-15 22:12 svesse
  2002-10-16  0:46 ` Dennis Lee Bieber
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: svesse @ 2002-10-15 22:12 UTC (permalink / 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;
-------




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

end of thread, other threads:[~2002-10-17 12:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-15 22:12 Why does this happen? svesse
2002-10-16  0:46 ` 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

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