1! { dg-do compile }
2! { dg-options "-O0" }
3! Tests the fix for PR24207 and the problems associated
4! with the fix for PR21986. In two cases, use associated
5! public symbols were taking on the default private access
6! attribute of the local namespace. In the third, a private
7! symbol was not available to a namelist in contained
8! procedure in the same module.
9!
10! Based on the example in PR24207.
11!
12module a
13  implicit none
14  real b
15  type :: mytype
16    integer :: c
17  end type mytype
18end module a
19module c
20  use a
21  implicit none
22  public d
23  private
24  real x
25  contains
26     subroutine d (arg_t)   ! This would cause an error
27        type (mytype) :: arg_t
28        namelist /e/ b, x   ! .... as would this.
29        read(5,e)
30	arg_t%c = 42
31     end subroutine d
32end module c
33