以下内容无法在 Intel Fortran XE 2011 中编译:
TYPE type1
procedure(interface1),POINTER::p
END TYPE type1
ABSTRACT INTERFACE
integer function interface1(a)
real,intent(in)::a
END function interface1
END INTERFACE
错误:
error #8262: The passed-object dummy argument must be dummy data object with the same declared type as the type being defined.
最佳答案
添加 nopass
属性到过程指针组件的声明。
procedure(interface1), pointer, nopass :: p
编辑:针对您的评论,如果您想使用 pass 关键字,则必须将界面更改为:
抽象接口(interface)
整数函数 interface1(passed_object, a)
进口::type1
类(type1),意图(...)::passed_object
真实的,意图(in)::a
END函数接口(interface)1
结束接口(interface)
关于pointers - 过程指针,派生类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5502592/