- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry if it has been reported already, but I couldn't find it through the forum search.
When I try to compile the code below, I get "error #8305: The derived type specifier shall not specify an abstract type. [SOMETYPE]...". Is the error really due to the "abstract" attribute or is it just something related to the derived-type keyword initialization bug I reported before? If I remove the abstract keyword (and the deferred procedure line), or if the "buffer" variable in mod2 is not initialized, the code compiles just fine.
When I try to compile the code below, I get "error #8305: The derived type specifier shall not specify an abstract type. [SOMETYPE]...". Is the error really due to the "abstract" attribute or is it just something related to the derived-type keyword initialization bug I reported before? If I remove the abstract keyword (and the deferred procedure line), or if the "buffer" variable in mod2 is not initialized, the code compiles just fine.
[fortran]module mod1
implicit none
private
save
type, abstract, public :: someType
character(4095), private :: txt = ''
! character(:), allocatable :: txt
contains
procedure(INTERFACE_DO_SOMETHING), deferred :: do_something
procedure, non_overridable :: reset
end type
type, extends(someType), public :: someOtherType
character(63), public :: file = ''
contains
procedure :: do_something => someOtherType_do_something
end type
abstract interface
subroutine INTERFACE_DO_SOMETHING (this, TXT, EXTRA)
import
class(someType), intent(INOUT) :: this
character(*), intent(IN) :: TXT, EXTRA
end subroutine
end interface
contains
subroutine reset(this)
class(someType), intent(INOUT) :: this
continue
this%txt = ''
end subroutine
subroutine someOtherType_do_something(this, TXT, EXTRA)
class(someOtherType), intent(INOUT) :: this
character(*), intent(IN) :: TXT, EXTRA
continue
end subroutine
end module mod1
module mod2
use mod1
implicit none
private
save
type(someOtherType) :: buffer = someOtherType(file = 'data.dat')
end module mod2
[/fortran]
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is in the structure constructor in line 54 - if you remove that, the error goes away. I know we have had issues with structure constructors and extended types - this may be related. We'll check it out.
Escalated as issue DPD200156388.
Escalated as issue DPD200156388.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is in the structure constructor in line 54 - if you remove that, the error goes away. I know we have had issues with structure constructors and extended types - this may be related. We'll check it out.
Escalated as issue DPD200156388.
Escalated as issue DPD200156388.
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