Debian Codegraph @

gcc/testsuite/gfortran.dg/class_20.f03

raw
1 ! { dg-do compile }
2 !
3 ! PR 44044: [OOP] SELECT TYPE with class-valued function
4 ! comment #1
5 !
6 ! Note: All three error messages are being checked for double occurrence,
7 ! using the trick from PR 30612.
8 !
9 ! Contributed by Janus Weil <[email protected]>
10
11
12 implicit none
13
14 type :: t
15 end type
16
17 type :: s
18 sequence
19 end type
20
21 contains
22
23 function fun() ! { dg-bogus "must be dummy, allocatable or pointer.*must be dummy, allocatable or pointer" }
24 class(t) :: fun
25 end function
26
27 function fun2() ! { dg-bogus "cannot have a deferred shape.*cannot have a deferred shape" }
28 integer,dimension(:) :: fun2
29 end function
30
31 function fun3() result(res) ! { dg-bogus "is not extensible.*is not extensible" }
32 class(s),pointer :: res
33 end function
34
35 end
36
37
38 ! { dg-error "must be dummy, allocatable or pointer" "" { target *-*-* } 23 }
39 ! { dg-error "cannot have a deferred shape" "" { target *-*-* } 27 }
40 ! { dg-error "is not extensible" "" { target *-*-* } 31 }