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