2 ! Test for allocatable scalar components and deferred length char arrays.
3 ! Check that fix for pr61275 works.
4 ! Contributed by Antony Lewis <antony@cosmologist.info> and
5 ! Andre Vehreschild <vehre@gmx.de>
10 integer, allocatable :: y
11 character(len=:), allocatable :: c
15 program test_allocatable_components
20 Me= A(X= 1, Y= 2, C="correctly allocated")
23 if (.not. allocated(Me%y) .or. Me%y /= 2) STOP 2
24 if (.not. allocated(Me%c)) STOP 3
25 if (len(Me%c) /= 19) STOP 4
26 if (Me%c /= "correctly allocated") STOP 5
28 ! Now check explicitly allocated components.
32 ! Implicit allocate on assign in the next line
33 Ea%c = "13 characters"
36 if (.not. allocated(Ea%y) .or. Ea%y /= 42) STOP 7
37 if (.not. allocated(Ea%c)) STOP 8
38 if (len(Ea%c) /= 13) STOP 9
39 if (Ea%c /= "13 characters") STOP 10
43 if (allocated(Ea%y)) STOP 11
44 if (allocated(Ea%c)) STOP 12