1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Procedure pointer assignments and argument association with intrinsic functions
5 real function realToReal(a
)
8 real function intToReal(n
)
9 integer, intent(in
) :: n
12 procedure(), pointer :: noInterfaceProcPtr
13 procedure(realToReal
), pointer :: realToRealProcPtr
14 procedure(intToReal
), pointer :: intToRealProcPtr
15 intrinsic :: float
! restricted specific intrinsic functions
16 intrinsic :: sqrt
! unrestricted specific intrinsic functions
17 external :: noInterfaceExternal
19 elemental
real function userElemental(a
)
24 !ERROR: 'float' is not an unrestricted specific intrinsic procedure
25 noInterfaceProcPtr
=> float
26 !ERROR: 'float' is not an unrestricted specific intrinsic procedure
27 intToRealProcPtr
=> float
28 !ERROR: 'float' is not an unrestricted specific intrinsic procedure
30 !ERROR: 'float' is not an unrestricted specific intrinsic procedure
32 !ERROR: 'float' is not an unrestricted specific intrinsic procedure
35 noInterfaceProcPtr
=> sqrt
! ok
36 realToRealProcPtr
=> sqrt
! ok
37 !ERROR: Procedure pointer 'inttorealprocptr' associated with incompatible procedure designator 'sqrt': incompatible dummy argument #1: incompatible dummy data object types: REAL(4) vs INTEGER(4)
38 intToRealProcPtr
=> sqrt
41 !ERROR: Actual procedure argument has interface incompatible with dummy argument 'p=': incompatible dummy argument #1: incompatible dummy data object types: REAL(4) vs INTEGER(4)
44 noInterfaceProcPtr
=> noInterfaceExternal
! ok
45 realToRealProcPtr
=> noInterfaceExternal
! ok
46 intToRealProcPtr
=> noInterfaceExternal
!ok
47 call sub1(noInterfaceExternal
) ! ok
48 !WARNING: Actual procedure argument has an implicit interface which is not known to be compatible with dummy argument 'p=' which has an explicit interface
49 call sub2(noInterfaceExternal
)
50 !WARNING: Actual procedure argument has an implicit interface which is not known to be compatible with dummy argument 'p=' which has an explicit interface
51 call sub3(noInterfaceExternal
)
53 !ERROR: Procedure pointer 'nointerfaceprocptr' with implicit interface may not be associated with procedure designator 'userelemental' with explicit interface that cannot be called via an implicit interface
54 noInterfaceProcPtr
=> userElemental
55 !ERROR: Non-intrinsic ELEMENTAL procedure 'userelemental' may not be passed as an actual argument
56 call sub1(userElemental
)
63 procedure(realToReal
) :: p
66 procedure(intToReal
) :: p