2 ! Tests the fix for PR67091 in which the first call to associated
3 ! gave a bad result because the 'target' argument was not being
6 ! Contributed by 'FortranFan' on clf.
7 ! https://groups.google.com/forum/#!topic/comp.lang.fortran/dN_tQA1Mu-I
14 integer, pointer :: m_i
17 procedure, pass(this), public :: iptr => getptr
18 procedure, pass(this), public :: setptr
21 subroutine setptr( this, iptr )
23 class(t), intent(inout) :: this
24 integer, pointer, intent(inout) :: iptr
28 function getptr( this ) result( iptr )
30 class(t), intent(in) :: this
32 integer, pointer :: iptr
42 !.. create i with some value
43 allocate (i, source=42)
45 if (.not.associated (i, foo%iptr())) STOP 1 ! Gave bad result.
46 if (.not.associated (foo%iptr(), i)) STOP 2 ! Was OK.
48 if (.not.associated (i, j)) STOP 1! Was OK.