| 1 |
! { dg-do compile } |
| 2 |
! Tests the fix for PR32827, in which IMPORT :: my_type put the |
| 3 |
! symbol into the interface namespace, thereby generating an error |
| 4 |
! when the declaration of 'x' is compiled. |
| 5 |
! |
| 6 |
! Contributed by Douglas Wells <[email protected]> |
| 7 |
! |
| 8 |
subroutine func1(param) |
| 9 |
type :: my_type |
| 10 |
sequence |
| 11 |
integer :: data |
| 12 |
end type my_type |
| 13 |
type(my_type) :: param |
| 14 |
param%data = 99 |
| 15 |
end subroutine func1 |
| 16 |
|
| 17 |
subroutine func2(param) |
| 18 |
type :: my_type |
| 19 |
sequence |
| 20 |
integer :: data |
| 21 |
end type my_type |
| 22 |
type(my_type) :: param |
| 23 |
param%data = 21 |
| 24 |
end subroutine func2 |
| 25 |
|
| 26 |
type :: my_type |
| 27 |
sequence |
| 28 |
integer :: data |
| 29 |
end type my_type |
| 30 |
|
| 31 |
interface |
| 32 |
subroutine func1(param) |
| 33 |
import :: my_type |
| 34 |
type(my_type) :: param |
| 35 |
end subroutine func1 |
| 36 |
end interface |
| 37 |
interface |
| 38 |
subroutine func2(param) |
| 39 |
import |
| 40 |
type(my_type) :: param |
| 41 |
end subroutine func2 |
| 42 |
end interface |
| 43 |
|
| 44 |
type(my_type) :: x |
| 45 |
call func1(x) |
| 46 |
print *, x%data |
| 47 |
call func2(x) |
| 48 |
print *, x%data |
| 49 |
end |