No specific function for generic when passing a polymorphic argument

前端 未结 1 1048
暖寄归人
暖寄归人 2021-01-24 18:58

I have created an interface for the following functions

Interface numd
  Module Procedure :: numcl_int8,    numcl_int16  
  Module Procedure :: numcl_int32,   nu         


        
相关标签:
1条回答
  • 2021-01-24 19:08

    The second actual argument (mold=ct) in the call to numd in the opscanc subroutine has a declared type that is unlimited polymorphic. Based on your example of the interface of the specific procedures, none of the specific procedures in the generic interface have the type of the second dummy argument as unlimited polymorphic.

    An unlimited polymorphic actual argument is not type compatible with a dummy argument that has some declared type, so there is no matching specific procedure to call.

    (The direction of the comparison is important here - an actual argument that has some declared type is compatible with a dummy argument that is unlimited polymorphic - hence the default integer literal constant 5 can be associated with the first dummy argument that is unlimited polymorphic.)

    You either need to provide such a matching specific procedure, or use a SELECT TYPE construct inside opscanc to access the object nominated by ct via a declared type that is its dynamic type (or a parent type of its dynamic type).

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