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