过程指针,派生类型

时间:2011-03-31 15:47:31

标签: pointers fortran function-pointers

以下内容无法在英特尔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.

1 个答案:

答案 0 :(得分:8)

nopass属性添加到过程指针组件的声明中。

procedure(interface1), pointer, nopass :: p

编辑:为了回应你的评论,如果你想使用pass关键字,那么必须改变界面:

ABSTRACT INTERFACE 
    integer function interface1(passed_object, a)
        import :: type1
        class(type1), intent(...) :: passed_object
        real,         intent(in)  :: a
    END function interface1
END INTERFACE
相关问题