| 1 |
! { dg-do compile } |
| 2 |
! PR fortran/71884 - reject NULL as source-expr in ALLOCATE with SOURCE= or MOLD= |
| 3 |
! |
| 4 |
! Contributed by G.Steinmetz |
| 5 |
|
| 6 |
program p |
| 7 |
real, allocatable :: a |
| 8 |
real, pointer :: b |
| 9 |
class(*), allocatable :: x |
| 10 |
class(*), pointer :: y |
| 11 |
|
| 12 |
allocate (x, source=null()) ! { dg-error "NULL cannot be used as source-expr" } |
| 13 |
allocate (y, source=null(b)) ! { dg-error "NULL cannot be used as source-expr" } |
| 14 |
allocate (x, mold=null(b)) ! { dg-error "NULL cannot be used as source-expr" } |
| 15 |
allocate (y, mold=null()) ! { dg-error "NULL cannot be used as source-expr" } |
| 16 |
end |