- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
I am not sure, but it seems these "passed" arguments must all be polymorphic variables.
(The compiler does not complain though)
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Regards,
Arjen

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page