[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_77.f90
blob5cbfe3aad65a6e16ac9105bfc6a679ae56bd8485
1 ! { dg-do run }
3 ! PR libfortran/51825 - Fortran runtime error: Cannot match namelist object name
4 ! Test case derived from PR.
6 module local_mod
8 type mytype1
9 integer :: int1
10 end type
12 type mytype2
13 integer :: n_x
14 integer :: n_px
15 end type
17 type beam_init_struct
18 character(16) :: chars(1) = ''
19 type (mytype1) dummy
20 type (mytype2) grid(1)
21 end type
23 end module
25 program error_namelist
27 use local_mod
29 implicit none
31 type (beam_init_struct) beam_init
33 namelist / error_params / beam_init
35 open (10, status='scratch')
36 write (10, '(a)') "&error_params"
37 write (10, '(a)') " beam_init%chars(1)='JUNK'"
38 write (10, '(a)') " beam_init%grid(1)%n_x=3"
39 write (10, '(a)') " beam_init%grid(1)%n_px=2"
40 write (10, '(a)') "/"
41 rewind(10)
42 read(10, nml=error_params)
43 close (10)
45 if (beam_init%chars(1) /= 'JUNK') call abort
46 if (beam_init%grid(1)%n_x /= 3) call abort
47 if (beam_init%grid(1)%n_px /= 2) call abort
49 end program