1! { dg-do compile }
2! { dg-options "-fcoarray=single" }
3!
4! Coarray declaration constraint checks
5!
6
7function foo3a() result(res)
8  implicit none
9  integer :: res
10  codimension :: res[*] ! { dg-error "CODIMENSION attribute conflicts with RESULT" }
11end
12
13function foo2a() result(res)
14  integer :: res[*] ! { dg-error "CODIMENSION attribute conflicts with RESULT" }
15end
16
17function fooa() result(res) ! { dg-error "shall not be a coarray or have a coarray component" }
18  implicit none
19  type t
20    integer, allocatable :: A[:]
21  end type t
22  type(t):: res
23end
24
25function foo3() ! { dg-error "shall not be a coarray or have a coarray component" }
26  implicit none
27  integer :: foo3
28  codimension :: foo3[*]
29end
30
31function foo2() ! { dg-error "shall not be a coarray or have a coarray component" }
32  implicit none
33  integer :: foo2[*]
34end
35
36function foo() ! { dg-error "shall not be a coarray or have a coarray component" }
37  type t
38    integer, allocatable :: A[:]
39  end type t
40  type(t):: foo
41end
42
43subroutine test()
44  use iso_c_binding
45  implicit none
46  type(c_ptr), save :: caf[*] ! { dg-error "shall not be a coarray" }
47end subroutine test
48
49subroutine test2()
50  use iso_c_binding
51  implicit none
52  type(c_funptr), save :: caf[*] ! { dg-error "shall not be a coarray" }
53end subroutine test2
54