Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Procedure Pointer, Passed-Objects

mklvml
Beginner
620 Views

In the example availablehere, I try to define a type that has a procedure pointer component f. I also have the PASS option active, which means that the first argument of f is the passed-object argument.

In the program, f is associated with a subroutine called proc1, which changes the component i to 999. However, if I run the program, i is not changed and instead stays 123.

What is my mistake?

Thanks

0 Kudos
5 Replies
Arjen_Markus
Honored Contributor II
620 Views
If you change the type of A in proc1 to "class(derivedType), intent(inout):: A" it does work.
I am not sure, but it seems these "passed" arguments must all be polymorphic variables.

(The compiler does not complain though)

Regards,

Arjen
0 Kudos
mklvml
Beginner
620 Views
Thanks!
But now I have a new problem. The code produces the following error:
error #6404: This name does not have a type, and must have an explicit type.
When I remove the "implicit none" in the actract interface the error dissappears. Why?
0 Kudos
Arjen_Markus
Honored Contributor II
620 Views
Hm, I think this is a compiler error - I have tried it with gfortran as well and that did not
complain. The second "implicit none" seems superfluous to me, as the one from the encompassing
module serves that purpose, but that is no reason for the compiler to produce such messages.

Regards,

Arjen
0 Kudos
Steven_L_Intel1
Employee
620 Views
The error is the same as reported here.
0 Kudos
Arjen_Markus
Honored Contributor II
620 Views
I see, yes, different scopes (hence the requirement for an import/use statement there). Your observation that the implicit none has effects outside the intended scope is the more accurate description of what is going wrong.

Regards,

Arjen
0 Kudos
Reply