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")
22 if (Me%X /= 1) call abort()
23 if (.not. allocated(Me%y) .or. Me%y /= 2) call abort()
24 if (.not. allocated(Me%c)) call abort()
25 if (len(Me%c) /= 19) call abort()
26 if (Me%c /= "correctly allocated") call abort()
28 ! Now check explicitly allocated components.
32 ! Implicit allocate on assign in the next line
33 Ea%c = "13 characters"
35 if (Ea%X /= 9) call abort()
36 if (.not. allocated(Ea%y) .or. Ea%y /= 42) call abort()
37 if (.not. allocated(Ea%c)) call abort()
38 if (len(Ea%c) /= 13) call abort()
39 if (Ea%c /= "13 characters") call abort()
43 if (allocated(Ea%y)) call abort()
44 if (allocated(Ea%c)) call abort()