- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following simple code compiles with no errors or warnings with compiler 16.0, however the procedure pointer assignment at line 33 has a rank and allocatable attribute mismatch in function result. It'll be nice if the compiler can warn about this.
module m
implicit none
abstract interface
function Iget_i() result(iarr)
!.. function result
integer :: iarr
end function Iget_i
end interface
procedure(Iget_i), pointer :: get => null()
contains
function get_i() result(iarr)
!..function result
integer, allocatable :: iarr(:)
iarr = [ 0 ]
return
end function get_i
subroutine sub()
get => get_i
end subroutine sub
end module m
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another variant of the interface mismatch problem:
module m
implicit none
abstract interface
function Iget_i() result(iarr)
!.. function result
integer :: iarr(1)
end function Iget_i
end interface
procedure(Iget_i), pointer :: get => null()
contains
function get_i() result(iarr)
!..function result
integer, allocatable :: iarr(:)
iarr = [ 0 ]
return
end function get_i
subroutine sub()
get => get_i
end subroutine sub
end module m
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And a third:
module m
implicit none
abstract interface
function Iget_i() result(iarr)
!.. function result
integer, allocatable :: iarr(:)
end function Iget_i
end interface
procedure(Iget_i), pointer :: get => null()
contains
function get_i() result(iarr)
!..function result
integer :: iarr(1)
iarr = [ 0 ]
return
end function get_i
subroutine sub()
get => get_i
end subroutine sub
end module m
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you FortranFan. I submit these to Development for their consideration.
Updated 11/19/2015: Submitted to Development
(Internal tracking id: DPD200378947)
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