Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29249 Discussions

Wrong error message triggered by the ABSTRACT attribute?

John4
Valued Contributor I
547 Views
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.

[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]

0 Kudos
1 Solution
Steven_L_Intel1
Employee
547 Views
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.

View solution in original post

0 Kudos
1 Reply
Steven_L_Intel1
Employee
548 Views
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.
0 Kudos
Reply