Debian Codegraph @

gcc/testsuite/gfortran.dg/associate_55.f90

raw
1 ! { dg-do compile }
2 !
3 ! Test the fix for PR93701.
4 !
5 ! Contributed by Simon Brass <[email protected]>
6 !
7 module test
8 implicit none
9
10 integer, parameter :: N_STATE = 1, &
11 TEST_STATE = 1
12
13 type :: test_t
14 integer, dimension(:), allocatable :: state
15 end type test_t
16
17 contains
18
19 subroutine test_allocate (obj)
20 class(test_t), intent(out) :: obj
21 allocate (obj%state(N_STATE))
22 end subroutine test_allocate
23
24
25 subroutine test_alter_state2 (obj, a)
26 class(test_t), intent(inout) :: obj
27 integer, intent(in) :: a
28 associate (state => obj%state(TEST_STATES)) ! { dg-error "no IMPLICIT type" }
29 state = a ! { dg-error "cannot be used in a variable definition context" }
30 ! state(TEST_STATE) = a
31 end associate
32 end subroutine test_alter_state2
33
34 end module test
35