comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus+rm.tsoh@maps.futureapps.de>
Subject: Re: Pure, Storage_Size and Unchecked_Conversion
Date: Mon, 09 Jul 2007 23:31:36 +0200
Date: 2007-07-09T23:31:36+02:00	[thread overview]
Message-ID: <1184016696.11692.6.camel@sonnenregen> (raw)
In-Reply-To: <1183987879.777428.313710@a26g2000pre.googlegroups.com>

On Mon, 2007-07-09 at 06:31 -0700, Y.Tomino wrote:

> Generic functions like Ada.Unchecked_Conversion
> (or my generic function I tested *1) are disallowed.
> 
> What is different ?

Maybe that is it, the generic formal pointer types (to
which the 'Storage_Size does not apply, then?)
The code below compile using GNAT GPL 2007.
The issue might be a question for your friendly Ada support
team...

package PP is

   pragma pure(PP);

   type Ptr is access Integer;
   for Ptr'Storage_Size use 0;

   generic
      type T is private;
   function G(X : Ptr) return Ptr;
      -- (Note: Ptr is not a generic formal here)

end PP;

with PP;
function F2 is new PP.G(Integer);
pragma pure(F2);

package body PP is
   function G(X : Ptr) return Ptr is
   begin
      return X;
   end G;
end PP;

> *1
> generic type T is private; type A is access T;
> function G (X : A) return A;
> pragma Pure (G); --OK
> 
> function G (X : A) return A is begin return X; end G;
> 
> with G;
> package P is
> pragma Pure (P);
> type A is access Integer; for A'Storage_Size use 0; --OK
> function F1 (X : A) return A; --OK
> function F2 is new G (A); --NG
> end P;





  reply	other threads:[~2007-07-09 21:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-08  0:24 Pure, Storage_Size and Unchecked_Conversion Y.Tomino
2007-07-08  9:49 ` Georg Bauhaus
2007-07-08 10:41   ` Y.Tomino
2007-07-08 16:08 ` Martin Krischik
2007-07-09 13:31   ` Y.Tomino
2007-07-09 21:31     ` Georg Bauhaus [this message]
2007-07-10  1:35 ` Randy Brukardt
2007-07-10  8:30   ` Georg Bauhaus
2007-07-15 17:30   ` Y.Tomino
replies disabled

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