| 1 |
! { dg-options "-std=f95" } |
| 2 |
! PR fortran/23994 |
| 3 |
! |
| 4 |
! Test PROTECTED attribute. Within the module everything is allowed. |
| 5 |
! Outside (use-associated): For pointers, their association status |
| 6 |
! may not be changed. For nonpointers, their value may not be changed. |
| 7 |
! |
| 8 |
! Reject in Fortran 95 |
| 9 |
|
| 10 |
module protmod |
| 11 |
implicit none |
| 12 |
integer :: a |
| 13 |
integer, target :: at |
| 14 |
integer, pointer :: ap |
| 15 |
protected :: a, at, ap ! { dg-error "Fortran 2003: PROTECTED statement" } |
| 16 |
end module protmod |
| 17 |
|
| 18 |
module protmod2 |
| 19 |
implicit none |
| 20 |
integer, protected :: a ! { dg-error "Fortran 2003: PROTECTED attribute" } |
| 21 |
integer, protected, target :: at ! { dg-error "Fortran 2003: PROTECTED attribute" } |
| 22 |
integer, protected, pointer :: ap ! { dg-error "Fortran 2003: PROTECTED attribute" } |
| 23 |
end module protmod2 |