comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: formal package question
Date: Mon, 14 Feb 2011 10:59:44 +0100
Date: 2011-02-14T10:59:45+01:00	[thread overview]
Message-ID: <4d58fd11$0$6770$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <a1ce6c12-d389-4685-95b2-68159efefadc@s11g2000prs.googlegroups.com>

On 14.02.11 03:46, ytomino wrote:
> Hello,
> Please look this code:
> 
> --------
> package formalpkg is
> 
>    generic
>       type T is private;
>       with procedure P (X : T) is <>;
>    package F is
>    end F;
> 
>    generic
>       with package FA is new F (others => <>);
>    package B is
>    end B;
> 
>    procedure P1 (X : Character) is null;
>    package F1 is new F (Character, P1); -- use P => P1
> 
>    package B1 is new B (F1); -- Error !!
> 
>    procedure P (X : Character) is null;
>    package F2 is new F (Character); -- P => P
> 
>    package B2 is new B (F2); -- OK
> 
> end formalpkg;
> --------
> % gnatmake formalpkg.ads
> gcc -c formalpkg.ads
> formalpkg.ads:17:25: actual for "P" in actual instance does not match
> formal
> gnatmake: "formalpkg.ads" compilation error
> --------
> 
> B1 was compile error, but B2 is ok. Why?

I get an error for B2, probably using a different GNAT.
Not really an answer, but can you leave out the "others"
in ([others =>] <>) ?

package Formalpkg is

    generic
        type T is private;
        with procedure P (X : T) is <>;
    package F is
    end F;

    generic
        with package FA is new F (<>);
    package B is
    end B;

    procedure P1 (X : Character) is null;
    package F1 is new F (Character, P1);

    package B1 is new B (F1);

    procedure P (X : Character) is null;
    package F2 is new F (Character);

    package B2 is new B (F2);

end Formalpkg;




  parent reply	other threads:[~2011-02-14  9:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14  2:46 formal package question ytomino
2011-02-14  6:51 ` anon
2011-02-15  0:08   ` ytomino
2011-02-14  9:59 ` Georg Bauhaus [this message]
2011-02-14 15:38   ` Adam Beneschan
2011-02-15  0:31   ` ytomino
2011-02-15  8:17     ` Ludovic Brenta
2011-02-17  0:58       ` ytomino
2011-02-17  7:05         ` Ludovic Brenta
replies disabled

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