小编Jes*_*ing的帖子

实例化具有对变体记录的子类型访问权限的包时出现问题

我尝试使用 Ada 2012 编译器编译 Ada 95 程序。然而,通用包的实例化存在问题Garbage_CollectorA_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_Termtype 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)

generics ada

5
推荐指数
2
解决办法
123
查看次数

标签 统计

ada ×1

generics ×1