将不同的声明类型传递给绑定过程 Fortran

Pass a different declared type to a binding procedure Fortran

给定以下代码

  type t1 
     integer :: dum 
  type(aop), alloctable  :: bc(:) 
  end type t1 

 type aop 
   procedure(A_INT), pass(t1), pointer :: ptr => null()
 end type aop 

 abstract interface 
    subroutine A_INT ( this ) 
            import t1
            class(t1) , intent(in) :: this 
    end subroutine 

 end interface 

有人可以解释为什么这是非法的吗?至少编译器说

error #8170: The passed-object dummy argument is missing from the procedure interface.   [A_INT]
            procedure(A_INT), pass(t1),
   -------------------^

已更新

当我这样做时

  type t1 
     integer :: dum 
  type(aop), alloctable  :: bc(:) 
  end type t1 

 type aop 
   procedure(A_INT), pass(this), pointer :: ptr => null()
 end type aop 

 abstract interface 
    subroutine A_INT ( this ) 
            import t1
            class(t1) , intent(in) :: this 
    end subroutine 

 end interface 

我收到以下错误

error #8262: For a type-bound procedure that has the PASS binding attribute, the first dummy argument must have the same declared type as the type being defined.   [THIS]
             subroutine A_INT(  this

我猜这意味着编译器希望第一个参数是 aop 类型? thist1 类型是不可能的吗?

您正在使用 pass(t1),但没有伪参数 t1,只有 this 类型的参数 t1

对于一个虚拟参数,我通常不会在这里使用任何明确的 pass。传递的伪参数只有在其类型与定义指针的类型相同时才有意义。否则,对于其他类型的参数,只需使用nopass