| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 42188: [OOP] F03:C612. The leftmost part-name shall be the name of a data object |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
module grid_module |
| 8 |
implicit none |
| 9 |
type grid |
| 10 |
contains |
| 11 |
procedure :: new_grid |
| 12 |
procedure :: new_int |
| 13 |
end type |
| 14 |
contains |
| 15 |
subroutine new_grid(this) |
| 16 |
class(grid) :: this |
| 17 |
end subroutine |
| 18 |
integer function new_int(this) |
| 19 |
class(grid) :: this |
| 20 |
new_int = 42 |
| 21 |
end function |
| 22 |
end module |
| 23 |
|
| 24 |
module field_module |
| 25 |
use grid_module |
| 26 |
implicit none |
| 27 |
|
| 28 |
type field |
| 29 |
type(grid) :: mesh |
| 30 |
end type |
| 31 |
|
| 32 |
contains |
| 33 |
|
| 34 |
type(field) function new_field() |
| 35 |
end function |
| 36 |
|
| 37 |
subroutine test |
| 38 |
integer :: i |
| 39 |
type(grid) :: g |
| 40 |
g = new_field()%mesh ! { dg-error "cannot be a function reference" } |
| 41 |
call new_field()%mesh%new_grid() ! { dg-error "Syntax error" } |
| 42 |
i = new_field() % mesh%new_int() ! { dg-error "cannot be a function reference" } |
| 43 |
end subroutine |
| 44 |
|
| 45 |
end module |