PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / derived_result_2.f90
blob51f5b8634945d3ea36da08db7777f9a9827d0af3
1 ! { dg-do compile }
3 ! PR 42188: [OOP] F03:C612. The leftmost part-name shall be the name of a data object
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
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
24 module field_module
25 use grid_module
26 implicit none
28 type field
29 type(grid) :: mesh
30 end type
32 contains
34 type(field) function new_field()
35 end function
37 subroutine test
38 integer :: i
39 type(grid) :: g
40 g = new_field()%mesh ! { dg-error "can not be a function reference" }
41 call new_field()%mesh%new_grid() ! { dg-error "Syntax error" }
42 i = new_field() % mesh%new_int() ! { dg-error "can not be a function reference" }
43 end subroutine
45 end module