Wrong error message triggered by the ABSTRACT attribute?

Wrong error message triggered by the ABSTRACT attribute?

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.

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

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

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.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today