- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just noticed another problem related to type-bound procedures.
When I declare an array of type tBase and pass it to a subroutine which expects an array of CLASS tBase, I am unable to call any type-bound procedures within the subroutine. They all result in an access violation.
See example code for details. The access violations occurs upon calling the type-bound procedure Test(). (Note that the crash occurs when using ArrPtr(1)%Test directly or via another class pointer Ptr%Test() ).
I have to admit that the construct is somewhat weird, but Idon't see why it should not be allowed.
regards,
Thomas
When I declare an array of type tBase and pass it to a subroutine which expects an array of CLASS tBase, I am unable to call any type-bound procedures within the subroutine. They all result in an access violation.
See example code for details. The access violations occurs upon calling the type-bound procedure Test(). (Note that the crash occurs when using ArrPtr(1)%Test directly or via another class pointer Ptr%Test() ).
I have to admit that the construct is somewhat weird, but Idon't see why it should not be allowed.
regards,
Thomas
[plain] module Types TYPE :: tBase INTEGER :: valBase CONTAINS PROCEDURE Test END TYPE CONTAINS SUBROUTINE TBProblem(ArrPtr) CLASS (tBase), INTENT(INOUT), TARGET :: ArrPtr(:) CLASS (tBase), POINTER :: Ptr Ptr => ArrPtr(1) CALL Ptr%Test() END SUBROUTINE SUBROUTINE Test(this) CLASS (tBase), INTENT(INOUT) :: this END SUBROUTINE Test end module program TypeBoundProcedures use Types implicit none ! Variables TYPE (tBase), TARGET :: Ext1(5) CALL TBProblem(Ext1) end program TypeBoundProcedures[/plain]
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, Thomas
It may seen silly my answer, but youshould call your function directly, without using the pointer or class structure. But if you are trying toaccess a routine from another object, then it does work. Just create an object and call like you did. Then it will work.
Regards,
Roger
It may seen silly my answer, but youshould call your function directly, without using the pointer or class structure. But if you are trying toaccess a routine from another object, then it does work. Just create an object and call like you did. Then it will work.
Regards,
Roger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think this is a bug we've recently fixed for a future update - I'll check that on Monday.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apparently this is a different bug. Issue ID is DPD200142454.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue from this thread has been fixed in our sources. The fix ought to appear in Update 5, planned for late January or early February.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually, update 6, available now.

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