1! { dg-do compile } 2! Test the fix for PR20903, in which derived types could be host associated within 3! interface bodies. 4! 5! Contributed by Joost VandeVondele <jv244@cam.ac.uk> 6! 7module test 8 implicit none 9 type fcnparms 10 integer :: i 11 end type fcnparms 12contains 13 subroutine sim_1(func1,params) 14 interface 15 function func1(fparams) 16 type(fcnparms) :: fparams ! { dg-error "is being used before it is defined" } 17 real :: func1 18 end function func1 19 end interface 20 type(fcnparms) :: params 21 end subroutine sim_1 22 23 subroutine sim_2(func2,params) 24 interface 25 function func2(fparams) ! This is OK because of the derived type decl. 26 type fcnparms 27 integer :: i 28 end type fcnparms 29 type(fcnparms) :: fparams 30 real :: func2 31 end function func2 32 end interface 33 type(fcnparms) :: params ! This is OK, of course 34 end subroutine sim_2 35end module test 36 37module type_decl 38 implicit none 39 type fcnparms 40 integer :: i 41 end type fcnparms 42end module type_decl 43 44subroutine sim_3(func3,params) 45 use type_decl 46 interface 47 function func3(fparams) 48 use type_decl 49 type(fcnparms) :: fparams ! This is OK - use associated 50 real :: func3 51 end function func3 52 end interface 53 type(fcnparms) :: params ! -ditto- 54end subroutine sim_3 55