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

Keyword (optinoal) arguments for generic type bound procedures

kf
Beginner
1,107 Views
Hello, I am evaluating the most recent (12.0.0) version of the Intel fortran compiler, and I thought I'd drop a line since I came across what looks like a bug.

Consider the following code. It uses a generic type bound procedure with a keyword (optional) argument.

[fortran]module mod_test
  implicit none
  type :: mytype
   contains
     procedure :: method1
     procedure :: method2
     generic :: method => method1, method2
  end type mytype
contains
  subroutine method1(self, i, c)
    class(mytype) :: self
    integer :: i
    character, optional :: c
  end subroutine method1
  subroutine method2(self, f, c)
    class(mytype) :: self
    real :: f
    character, optional :: c
  end subroutine method2
end module mod_test
program test
  use mod_test
  implicit none
  type(mytype) :: t
  call t%method(1, c='a')
  call t%method(1.0, c='b')
end program test[/fortran]

This code complies fine with the NAG fortran compiler 5.2, but not with the most recent Intel fortran compiler. The latter generates the error message:

test.f90(25): error #6632: Keyword arguments are invalid without an explicit interface.
call t%method(1, c='a')
-------------------^
test.f90(26): error #6632: Keyword arguments are invalid without an explicit interface.
call t%method(1.0, c='b')
---------------------^
compilation aborted for test.f90 (code 1)
0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,107 Views
Thanks for letting us know about this. I will report it to the developers. Issue ID is DPD200166645.
0 Kudos
Steven_L_Intel1
Employee
1,107 Views
This bug has been fixed in our sources - the fix will appear in a future version of the compiler.
0 Kudos
Reply