1! { dg-do compile } 2! 3! PR fortran/ 4! 5! Contributed by Neil Carlson 6! 7! Check whether passing an intent(in) pointer 8! to an intent(inout) nonpointer is allowed 9! 10module modA 11 type :: typeA 12 integer, pointer :: ptr 13 end type 14contains 15 subroutine foo (a,b,c) 16 type(typeA), intent(in) :: a 17 type(typeA), intent(in) , pointer :: b 18 class(typeA), intent(in) , pointer :: c 19 20 call bar (a%ptr) 21 call bar2 (b) 22 call bar3 (b) 23 call bar2 (c) 24 call bar3 (c) 25 call bar2p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } 26 call bar3p (b) ! { dg-error "Actual argument to .n. at \\(1\\) must be polymorphic" } 27 call bar2p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } 28 call bar3p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } 29 end subroutine 30 subroutine bar (n) 31 integer, intent(inout) :: n 32 end subroutine 33 subroutine bar2 (n) 34 type(typeA), intent(inout) :: n 35 end subroutine 36 subroutine bar3 (n) 37 class(typeA), intent(inout) :: n 38 end subroutine 39 subroutine bar2p (n) 40 type(typeA), intent(inout), pointer :: n 41 end subroutine 42 subroutine bar3p (n) 43 class(typeA), intent(inout), pointer :: n 44 end subroutine 45end module 46