| 1 |
! { dg-do compile } |
| 2 |
! PR fortran/56423 |
| 3 |
! |
| 4 |
! Check constraints on pointer targets for derived type constructors |
| 5 |
! |
| 6 |
! Contributed by Tobias Burnus and Gerhard Steinmetz |
| 7 |
|
| 8 |
program p |
| 9 |
integer, target :: x(3) = [7, 8, 9] |
| 10 |
type t |
| 11 |
integer, pointer :: a(:) |
| 12 |
end type |
| 13 |
type(t) :: z |
| 14 |
z = t(x) |
| 15 |
z = t(x(1:3)) |
| 16 |
z = t(x(3:1:-1)) |
| 17 |
z = t(x(2)) ! { dg-error "rank of the element in the structure constructor" } |
| 18 |
z = t(x([1,3])) ! { dg-error "has a vector subscript" } |
| 19 |
print *, z%a |
| 20 |
end |