- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reference F2003 syntax for generic interface members:
R1206 procedure-stmt is [ MODULE ] PROCEDURE procedure-name-list
The current compiler doesn't allow one to omit the MODULE keyword for module procedures. Example below.
[fortran]module M1
type :: c_opt
integer :: index = 0
end type
type, extends(c_opt) :: long_opt
integer :: val
end type long_opt
type, extends(c_opt) :: real_opt
real :: val
end type real_opt
!uncomment only one procedure-stmt below at a time to see compiler behavior
interface opt
module procedure opt_long, opt_real ! ok
!procedure opt_long, opt_real ! error #6643:This statement is incorrectly positioned.
! error #8168: Parentheses are required after the PROCEDURE keyword.
end interface opt
contains
function opt_long (i, v)
integer, intent(in) :: i
integer, intent(in) :: v
type(long_opt) :: opt_long
opt_long = long_opt(i, v)
end function
function opt_real (i, v)
integer, intent(in) :: i
real, intent(in) :: v
type(real_opt) :: opt_real
opt_real = real_opt(i, v)
end function
subroutine foo
print *, [opt(1,100), opt(2,200)]
print *, [opt(1,1.0), opt(2,2.0)]
end subroutine foo
end module M1
program C4
use :: M1
call foo
end program C4
[/fortran]
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - this one we know about. Fixed in a future release.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page