On 11.07.22 06:27, Stephen Leake wrote:
Since B.F is declared in a sibling package, it cannot a primitive of A.Some_Tagged, so the error message is wrong.
Since A.Some_Tagged is an interface, you can only declare abstract
primitive subprograms for it. So I suspect GNAT knows there's an error, but is
giving a confusing error message.
It seems possible to write programs declaring B.F (Param : A.Some_Tagged)..., but hardly one that isn't pointless! Adding "in out" to the
function's Param allows 'Access using 'Class renames Ref'(Param'Access).all
and then 'Unchecked_Access---so twisted I shan't repeat it here.
Adding (... : access A.Some_Tagged) works a lot better (of course <:-|),
and still has the warning.
But, GNAT is right, I think!
How are you intending F to be different from FC?
The first F was a bad choice, I guess; I had wanted to exclude a potentially larger interface. FC was the beginning of dropping F.
FC now takes an access to class-wide.
With Op1 added to the interface of Some_Tagged,
package B is
type Plain(<>) is private;
function FC (Param : access A.Some_Tagged'Class) return Plain;
procedure G (Item : in out Plain; Param : in Character);
-- Calls Op1 of Item.Client
private
type Plain (Client : access A.Some_Tagged'Class) is record
null;
end record;
end B;
No F, no warning.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)