aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/associate_25.f90
blob: 97b53f64ded798e7ffb94b8bf8061270cb3a564f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
! { dg-do run }
!
! Checks the fix for PR60483.
!
! Contributed by Anthony Lewis  <antony@cosmologist.info>
!
module A
  implicit none
  Type T
    integer :: val = 2
  contains
    final :: testfree
  end type
  integer :: final_flag = 0
contains
  subroutine testfree(this)
    Type(T) this
    final_flag = this%val + final_flag
  end subroutine
  subroutine Testf()
    associate(X => T()) ! This was failing: Symbol 'x' at (1) has no IMPLICIT type
      final_flag = X%val
    end associate
    if (final_flag .ne. 2) stop 1
  end subroutine Testf
end module

  use A
  call Testf
end