- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deal Intel Fortran Compiler Support team,
I'm getting a compiler error while allocating with mold a member variable of a recursive derived type. Is this legal or I'm committing some mistake?
The error message I get is the following one:
ifort-test.f90(30): error #8152: Neither the ERRMSG= variable nor any part of the source expression in SOURCE= or MOLD= specifiers may be allocated in the ALLOCATE statement in which it appears. [MY_OBJECT]
allocate(this%next_level%my_object, mold=this%my_object, stat=error)
------------------------------------------------------^
I can reproduce this with the code snippet below.
Thanks in advance,
Víctor.
module my_module
implicit none
private
type :: object_t
end type
type, extends(object_t) :: object1_t
end type
type, extends(object_t) :: object2_t
end type
type :: level_t
private
class(object_t), allocatable :: my_object
type(level_t), pointer :: next_level
contains
private
procedure :: allocate_next_level
end type
contains
subroutine allocate_next_level(this)
class(level_t), intent(inout) :: this
integer :: error
allocate(this%next_level, stat=error)
allocate(this%next_level%my_object, mold=this%my_object, stat=error) ! <- error occurs in this line
end subroutine
end module my_module
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - this is very similar to a problem we fixed a few years ago, but not quite the same. Escalated as issue DPD200415804.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page