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 <janus@gcc.gnu.org>
10
11
12implicit none
13
14type :: t
15end type
16
17type :: s
18  sequence
19end type
20
21contains
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
35end
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 }
41