2 ! { dg-shouldfail "Invalid Fortran 2003 code" }
3 ! { dg-options "-std=f2003 -fall-intrinsics" }
6 ! Test PROTECTED attribute. Within the module everything is allowed.
7 ! Outside (use-associated): For pointers, their association status
8 ! may not be changed. For nonpointers, their value may not be changed.
10 ! Test of a invalid code
14 integer, Protected
:: a
15 integer, protected
, target
:: at
16 integer, protected
, pointer :: ap
22 a
= 43 ! { dg-error "variable definition context" }
23 ap
=> null() ! { dg-error "pointer association context" }
24 nullify(ap
) ! { dg-error "pointer association context" }
25 ap
=> at
! { dg-error "pointer association context" }
27 allocate(ap
) ! { dg-error "pointer association context" }
29 call increment(a
,at
) ! { dg-error "variable definition context" }
30 call pointer_assignments(ap
) ! { dg-error "pointer association context" }
32 subroutine increment(a1
,a3
)
33 integer, intent(inout
) :: a1
, a3
36 end subroutine increment
37 subroutine pointer_assignments(p
)
38 integer, pointer,intent (inout
) :: p
40 end subroutine pointer_assignments
47 real, protected
:: b
! { dg-error "only allowed in specification part of a module" }