| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 45290: [F08] pointer initialization |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
module m1 |
| 8 |
implicit none |
| 9 |
type :: t |
| 10 |
integer, pointer :: p |
| 11 |
integer :: i |
| 12 |
end type |
| 13 |
integer, target :: i |
| 14 |
type(t), target :: x |
| 15 |
integer, pointer :: p1 => i |
| 16 |
integer, pointer :: p2 => p1 ! { dg-error "Pointer assignment target in initialization expression does not have the TARGET attribute at" } |
| 17 |
integer, pointer :: p3 => x%p ! { dg-error "must have the TARGET attribute" } |
| 18 |
integer, pointer :: p4 => x%i |
| 19 |
integer, pointer :: p5 => u ! { dg-error "has no IMPLICIT type" } |
| 20 |
end module m1 |
| 21 |
|
| 22 |
|
| 23 |
module m2 |
| 24 |
implicit none |
| 25 |
type :: t |
| 26 |
procedure(s), pointer, nopass :: ppc |
| 27 |
end type |
| 28 |
type(t) :: x |
| 29 |
procedure(s), pointer :: pp1 => s |
| 30 |
procedure(s), pointer :: pp2 => pp1 ! { dg-error "may not be a procedure pointer" } |
| 31 |
procedure(s), pointer :: pp3 => t%ppc ! { dg-error "Symbol 't' at .1. has no IMPLICIT type" } |
| 32 |
|
| 33 |
contains |
| 34 |
|
| 35 |
subroutine s |
| 36 |
end subroutine |
| 37 |
|
| 38 |
end module m2 |