comp.lang.ada
 help / color / mirror / Atom feed
* Return value that is an access to array element
@ 2002-08-05 16:57 Martin Dowie
  2002-08-05 23:32 ` Andreas Almroth
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Dowie @ 2002-08-05 16:57 UTC (permalink / raw)


Given the following code, should a compiler raise an error given
LM 3.10.2 (25) as an error or not?

generic
   type T is private;
   type TA is access all T;
package Foo is
   type XT is private;
   function Get (X : XT) return TA;
private
   type AT is array (Positive range <>) of aliased T;
   type AA is access AT;
   type XT is record
      A : AA;
   end record;
end Foo;

package body Foo is
   function Get (X : XT) return TA is
   begin
      return X.A (1)'Access;  -- Error here?
   end Get;
end Foo;





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

* Re: Return value that is an access to array element
  2002-08-05 16:57 Return value that is an access to array element Martin Dowie
@ 2002-08-05 23:32 ` Andreas Almroth
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Almroth @ 2002-08-05 23:32 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@btopenworld.com> writes:

> Given the following code, should a compiler raise an error given
> LM 3.10.2 (25) as an error or not?
> 
> generic
>    type T is private;
>    type TA is access all T;
> package Foo is
>    type XT is private;
>    function Get (X : XT) return TA;
> private
>    type AT is array (Positive range <>) of aliased T;
>    type AA is access AT;
>    type XT is record
>       A : AA;
>    end record;
> end Foo;
> 
> package body Foo is
>    function Get (X : XT) return TA is
>    begin
>       return X.A (1)'Access;  -- Error here?
>    end Get;
> end Foo;

?

GNAT 3.14p sure gives an error saying you can't use AT as an type, as it is a 
reserved word.

Compiles just fine when changes to something else...

My $0.25,
Andreas





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

end of thread, other threads:[~2002-08-05 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-05 16:57 Return value that is an access to array element Martin Dowie
2002-08-05 23:32 ` Andreas Almroth

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