通用接口与包含无限多态性指针的虚拟参数匹配



当我将fortran无限多态性指针用作虚拟论点时,我遇到了一件奇怪的事情。代码如下:

module TestValueOperation
  implicit none
  type TValue
    class(*),pointer :: Value => NULL()
  end type TValue
  interface ValueOperation
    module procedure :: ValueOperation1
  end interface ValueOperation
  contains
    subroutine ValueOperation1(Val)
      class(*),pointer :: Val
      write(*,*) "This is a test."
    end subroutine ValueOperation1
end module TestValueOperation
program main
  use TestValueOperation
  implicit none
  type(TValue) :: a
  call ValueOperation1(a%Value)  ! Case 1, valid
  call ValueOperation(a%Value)   ! Case 2, invalid
end program main

编译器只抱怨

"对于此通用子例程,没有匹配的特定子例程 致电"

使用案例1,但与案例2合作。谁能告诉我为什么?如果很重要,则编译器为ifort 2013_sp1.3.174

这是与具有无限多态性的虚拟参数相关的ifort的(已知)编译器错误,请参见此处。


gfortran接受并在我测试的所有版本中运行代码。

使用ifort I(成功)测试的版本2012和2013年。我没有2014年版本,但最新版本(2015)失败了您收到的消息。

最新更新