Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Error in generic binding with both functions and subroutines

$
0
0

Hi,

I've encountered what I believe is a bug in ifort version 14.0.0.

The problem occures when using a generic binding using both some functions and some subroutines.

A compilation error appears when a function is specified first in the generic binding declaration.

So, a simple workaround is to declare a subroutine first, then either functions or subroutines. The important point is that the first procedure to be declare must be a subroutine

Here a small example to reproduce the error.

Module Bug_Generic_Binding
  implicit none
  Type  ::      MyType
  contains
    generic     ::      MyProcedure => MySubroutine, MyFunction1, MyFunction2   ! THIS WORKS...
!     generic     ::      MyProcedure => MyFunction1, MyFunction2, MySubroutine ! THIS DON'T WORK => error #8447: A specific procedure must be a function for an OPERATOR generic binding.   [MYSUBROUTINE]
    procedure   ::      MySubroutine
    procedure   ::      MyFunction1
    procedure   ::      MyFunction2
  End Type
  contains
Pure Function MyFunction1( This, Inp1 ) result(Out1)
  class(MyType) ,intent(in)     ::      This
  real(8)       ,intent(in)     ::      Inp1
  real(8)                       ::      Out1
  Out1 = Inp1
End Function
Pure Function MyFunction2( This, Inp1, Inp2 ) result(Out1)
  class(MyType) ,intent(in)     ::      This
  real(8)       ,intent(in)     ::      Inp1
  real(8)       ,intent(in)     ::      Inp2
  real(8)                       ::      Out1
  Out1 = Inp1
End Function
Subroutine MySubroutine( This, Inp1, Out1, Out2)
  class(MyType) ,intent(in)     ::      This
  real(8)       ,intent(in)     ::      Inp1
  real(8)       ,intent(out)    ::      Out1
  real(8)       ,intent(out)    ::      Out2
  Out1 = Inp1
  Out2 = Inp1
End Subroutine
End Module

Viewing all articles
Browse latest Browse all 2583

Trending Articles



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