48 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! C1030 - assignment of pointers to intrinsic procedures3! C1515 - interface definition for procedure pointers4! C1519 - initialization of pointers to intrinsic procedures5program main6 intrinsic :: cos ! a specific & generic intrinsic name7 intrinsic :: alog10 ! a specific intrinsic name, not generic8 intrinsic :: null ! a weird special case9 intrinsic :: bessel_j0 ! generic intrinsic, not specific10 intrinsic :: amin011 intrinsic :: mod12 intrinsic :: llt13 !ERROR: 'haltandcatchfire' is not a known intrinsic procedure14 intrinsic :: haltandcatchfire15 16 abstract interface17 logical function chrcmp(a,b)18 character(*), intent(in) :: a19 character(*), intent(in) :: b20 end function chrcmp21 end interface22 23 !PORTABILITY: Procedure pointer 'p' should not have an ELEMENTAL intrinsic as its interface [-Wportability]24 procedure(sin), pointer :: p => cos25 !ERROR: Intrinsic procedure 'amin0' is not an unrestricted specific intrinsic permitted for use as the definition of the interface to procedure pointer 'q'26 procedure(amin0), pointer :: q27 !ERROR: Intrinsic procedure 'bessel_j0' is not an unrestricted specific intrinsic permitted for use as the definition of the interface to procedure pointer 'r'28 procedure(bessel_j0), pointer :: r29 !ERROR: Intrinsic procedure 'llt' is not an unrestricted specific intrinsic permitted for use as the initializer for procedure pointer 's'30 procedure(chrcmp), pointer :: s => llt31 !ERROR: Intrinsic procedure 'bessel_j0' is not an unrestricted specific intrinsic permitted for use as the initializer for procedure pointer 't'32 !PORTABILITY: Procedure pointer 't' should not have an ELEMENTAL intrinsic as its interface [-Wportability]33 procedure(cos), pointer :: t => bessel_j034 procedure(chrcmp), pointer :: u35 p => alog ! valid use of an unrestricted specific intrinsic36 p => alog10 ! ditto, but already declared intrinsic37 p => cos ! ditto, but also generic38 p => tan ! a generic & an unrestricted specific, not already declared39 !ERROR: Function pointer 'p' associated with incompatible function designator 'mod': function results have distinct types: REAL(4) vs INTEGER(4)40 p => mod41 !ERROR: Function pointer 'p' associated with incompatible function designator 'index': function results have distinct types: REAL(4) vs INTEGER(4)42 p => index43 !ERROR: 'bessel_j0' is not an unrestricted specific intrinsic procedure44 p => bessel_j045 !ERROR: 'llt' is not an unrestricted specific intrinsic procedure46 u => llt47end program main48