1! { dg-do compile }
2! { dg-options "-std=f2003" }
3! PR fortran/32601
4module pr32601
5use, intrinsic :: iso_c_binding, only: c_int
6contains
7  function get_ptr()
8    integer(c_int), pointer :: get_ptr
9    integer(c_int), target :: x
10    get_ptr = x
11  end function get_ptr
12end module pr32601
13
14USE ISO_C_BINDING, only: c_null_ptr, c_ptr, c_loc
15use pr32601
16implicit none
17
18type(c_ptr) :: t
19t = c_null_ptr
20
21! Next two lines should be errors if -pedantic or -std=f2003
22print *, c_null_ptr, t  ! { dg-error "cannot have PRIVATE components" }
23print *, t ! { dg-error "cannot have PRIVATE components" }
24
25print *, c_loc(get_ptr()) ! { dg-error "cannot have PRIVATE components" }
26
27end
28