Procedure Pointer, Derived Type

后端 未结 1 1484
逝去的感伤
逝去的感伤 2021-01-05 15:52

The following doesnt compile in Intel Fortran XE 2011:

TYPE type1
    procedure(interface1),POINTER::p
END TYPE type1

ABSTRACT INTERFACE 
    integer functi         


        
1条回答
  •  感情败类
    2021-01-05 16:34

    Add the nopass attribute to the declaration of the procedure pointer component.

    procedure(interface1), pointer, nopass :: p
    

    Edit: In response to your comment, if you want to use the pass keyword, the interface would have to be changed as such:

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

    0 讨论(0)
提交回复
热议问题