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")
18 if (Me%X /= 1) call abort()
19 if (.not. allocated(Me%y) .or. Me%y /= 2) call abort()
20 if (.not. allocated(Me%c)) call abort()
21 if (len(Me%c) /= 19) call abort()
22 if (Me%c /= "correctly allocated") call abort()
24 ! Now check explicitly allocated components.
28 ! Implicit allocate on assign in the next line
29 Ea%c = "13 characters"
31 if (Ea%X /= 9) call abort()
32 if (.not. allocated(Ea%y) .or. Ea%y /= 42) call abort()
33 if (.not. allocated(Ea%c)) call abort()
34 if (len(Ea%c) /= 13) call abort()
35 if (Ea%c /= "13 characters") call abort()
39 if (allocated(Ea%y)) call abort()
40 if (allocated(Ea%c)) call abort()
43 ! vim:ts=4:sts=4:sw=4: