我尝试使用 Ada 2012 编译器编译 Ada 95 程序。然而,通用包的实例化存在问题Garbage_Collector。A_Term包实例化中不接受子类型:
prolog.adb:27:15: designated type of actual does not match that of formal "Link"
prolog.adb:27:15: instantiation abandoned
Run Code Online (Sandbox Code Playgroud)
我尝试更改A_Term为type A_Term is access A_Node;. 然后包将实例化,但其余代码中断。自 Ada 95 以来发生了一些变化,我如何使其在 Ada 2012 中工作?
procedure Prolog is
generic
type Item is limited private;
type Link is access Item;
package Garbage_Collector is
procedure Get (L : in out Link) is null;
end Garbage_Collector;
type Node_Tag is (A, B);
type Node (Tag : Node_Tag); …Run Code Online (Sandbox Code Playgroud)