From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Access to generic formal parameters in an generic package instantiation
Date: Tue, 31 Jul 2012 09:48:04 +0200
Date: 2012-07-31T09:48:02+02:00 [thread overview]
Message-ID: <50178db2$0$6562$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <87a9yi5t7j.fsf@mid.deneb.enyo.de>
On 29.07.12 20:16, Florian Weimer wrote:
> It seems that generic formal packages are unusual because GNAT shows
> some strange effects (and the occasional bug box).
Compilers seem to differ on this one, which should be Ada 95.
I am not sure the generics are properly addressing the issue
of type comparison (well, of convertibility).
With GNAT's bug boxes currently in the way I can't try the
Ada 2012 features. (Something about failures when testing entity
node kinds.)
generic
type T is private;
Fst, Snd : in T;
package Same_Type is end;
with Same_Type;
generic
type Ancestor is private ;
type T1 is new Ancestor;
type T2 is new Ancestor;
X : T1;
Y : T2;
-- with package Comparison is new Same_Type (T1, T1'(X), T1 (Y));
package Ops is
private
package Comparison_1 is new Same_Type (T1, T1'(X), T1 (Y));
package Comparison_2 is new Same_Type (T2, T2 (X), T2'(Y));
end;
with Same_Type, Ops;
procedure Test_G is
type Int is new Integer;
type Chr is new Character;
Two : constant Int := 2;
C : constant Chr := 'c';
package Test_1 is new Ops (Int, Int, Int, Two, Two);
--!GNAT! package Test_2 is new Ops (Int, Int, Chr, Two, C);
package PK is
type root is tagged null record;
type left is new root with null record;
type right is new root with null record;
end PK;
use pK;
L : Left;
R : Right;
package test_3 is new ops (Root, Left, Right, L, R);
begin
null;
end Test_G;
next prev parent reply other threads:[~2012-08-06 14:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-29 18:16 Access to generic formal parameters in an generic package instantiation Florian Weimer
2012-07-29 19:36 ` Dmitry A. Kazakov
2012-07-29 21:31 ` Florian Weimer
2012-07-30 18:37 ` Adam Beneschan
2012-07-30 18:33 ` Adam Beneschan
2012-07-31 7:48 ` Georg Bauhaus [this message]
2012-07-31 15:29 ` Adam Beneschan
2012-07-31 16:50 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox