1! { dg-do run }
2! PR libfortran/52512 - Cannot match namelist object name
3! Test case derived from PR.
4
5program testje
6
7    implicit none
8
9    integer :: getal, jn
10    type ptracer
11        character(len = 8)  :: sname  !: short name
12        logical             :: lini   !: read in a file or not
13    end type ptracer
14    type(ptracer) , dimension(3) :: tracer
15    namelist/namtoptrc/  getal,tracer
16
17    ! standard values
18    getal = 9999
19    do jn = 1, 3
20        tracer(jn)%sname = 'default_name'
21        tracer(jn)%lini = .false.
22    end do
23
24    open (10, status='scratch')
25    write (10, '(a)') "&namtoptrc"
26    write (10, '(a)') "   getal = 7"
27    write (10, '(a)') "   tracer(1) = 'DIC     ', .true."
28    write (10, '(a)') "   tracer(2) = 'Alkalini', .true."
29    write (10, '(a)') "   tracer(3) = 'O2      ', .true."
30    write (10, '(a)') "/"
31    rewind(10)
32    read(10, nml=namtoptrc)
33    close (10)
34
35    if (getal /= 7) STOP 1
36    if (tracer(1)%sname /= 'DIC     ') STOP 2
37    if (tracer(2)%sname /= 'Alkalini') STOP 3
38    if (tracer(3)%sname /= 'O2      ') STOP 4
39    if (.not. tracer(1)%lini) STOP 5
40    if (.not. tracer(2)%lini) STOP 6
41    if (.not. tracer(3)%lini) STOP 7
42
43end program testje
44