Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Two strange Warnings(6706;6738) with abstract interfaces

$
0
0

Hello, i get those two warning messages, when compiling the code below.

"(22) warning #6706: There is a mixture of specific functions and specific subroutines for one generic-spec.   [INTF_SETARRAY]"
"(28) warning #6738: The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name.   [INTF_GETSCALAR]"

I do not understand, what is wrong with those declarations. This contruct seems to work fine in my real code, but the warnings confused me.

Greetings
Wolf

Compiler: 15.5 and 16.1

module FOO
  implicit none

!=================================================================
  type, abstract :: ABSTRACT_TYPE
  contains

    procedure(intf_getArray),  deferred :: getArray
    procedure(intf_setArray),  deferred :: setArray
    procedure(intf_getScalar), deferred :: getScalar
    procedure(intf_setScalar), deferred :: setScalar

  end type ABSTRACT_TYPE

!=================================================================
  interface abstract
    real pure function intf_getArray(this) result(res)
      import :: ABSTRACT_TYPE
      class(ABSTRACT_TYPE), intent(in   ) :: this
    end function

    pure subroutine intf_setArray(this, inp)
      import :: ABSTRACT_TYPE
      class(ABSTRACT_TYPE), intent(inout) :: this
      real,                 intent(in   ) :: inp(3)
    end subroutine

    real elemental function intf_getScalar(this) result(laenge)
      import :: ABSTRACT_TYPE
      class(ABSTRACT_TYPE), intent(in   ) :: this
    end function

    elemental subroutine intf_setScalar(this, inp)
      import :: ABSTRACT_TYPE
      class(ABSTRACT_TYPE), intent(inout) :: this
      real,                 intent(in   ) :: inp
    end subroutine
  end interface

!=================================================================
  type, extends (ABSTRACT_TYPE) :: EXTENDED_TYPE
  contains
    procedure :: getArray     => getArray_Extended
    procedure :: getScalar    => getScalar_Extended
    procedure :: setArray     => setArray_Extended
    procedure :: setScalar    => setScalar_Extended

  end type EXTENDED_TYPE

!=================================================================
contains
!=================================================================


  pure function getArray_Extended(this) result(res)
    class(EXTENDED_TYPE), intent(in   ) :: this
    real                                :: res
  end function

  real elemental function getScalar_Extended(this)
    class(EXTENDED_TYPE), intent(in   ) :: this
  end function

  pure subroutine setArray_Extended(this, inp)
    class(EXTENDED_TYPE), intent(inout) :: this
    real,                 intent(in   ) :: inp(3)
  end subroutine

  elemental subroutine setScalar_Extended(this, inp)
    class(EXTENDED_TYPE), intent(inout) :: this
    real,                 intent(in   ) :: inp
  end subroutine setScalar_Extended

!=================================================================
end module FOO

 


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>