The following was reported by John McFarland:
PROGRAM prog
TYPE object
PROCEDURE(), POINTER, NOPASS :: f
END TYPE object
TYPE container
TYPE (object), POINTER :: o(:)
END TYPE container
TYPE (container) :: c
TYPE (object) :: o1, o2
PROCEDURE(), POINTER :: f => NULL()
o1%f => f
! This works
CALL set_func(o2,f)
! Here the compiler says the second argument has the wrong type?
CALL set_func(o2,o1%f)
! Same error as above, but want to make sure this case works too
ALLOCATE( c%o(5) )
c%o(5)%f => f
CALL set_func(o2,c%o(5)%f)
CONTAINS
SUBROUTINE set_func(o,f)
TYPE (object) :: o
PROCEDURE(), POINTER :: f
o%f => f
END SUBROUTINE set_func
END PROGRAM prog
This program is rejected with
test.f90:15.18:
CALL set_func(o2,o1%f)
1
Error: Type mismatch in argument 'f' at (1); passed REAL(4) to UNKNOWN
test.f90:19.18:
CALL set_func(o2,c%o(5)%f)
1
Error: Type mismatch in argument 'f' at (1); passed REAL(4) to UNKNOWN
In contrast to what these error messages say, the program seems to be valid.
--
Summary: [F03] passing a procedure pointer component to a
procedure pointer dummy
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42045