Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / bind-c09.f90
blobfe1972057e67bbaa48e5b994d92b16d49b7ba69b
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for C1553 and 18.3.4(1)
4 function func1() result(res) bind(c)
5 ! ERROR: BIND(C) function result cannot have ALLOCATABLE or POINTER attribute
6 integer, pointer :: res
7 end
9 function func2() result(res) bind(c)
10 ! ERROR: BIND(C) function result cannot have ALLOCATABLE or POINTER attribute
11 integer, allocatable :: res
12 end
14 function func3() result(res) bind(c)
15 ! ERROR: BIND(C) function result must be scalar
16 integer :: res(2)
17 end
19 function func4() result(res) bind(c)
20 ! ERROR: BIND(C) character function result must have length one
21 character(*) :: res
22 end
24 function func5(n) result(res) bind(c)
25 integer :: n
26 ! ERROR: BIND(C) character function result must have length one
27 character(n) :: res
28 end
30 function func6() result(res) bind(c)
31 ! ERROR: BIND(C) character function result must have length one
32 character(2) :: res
33 end
35 function func7() result(res) bind(c)
36 integer, parameter :: n = 1
37 character(n) :: res ! OK
38 end
40 function func8() result(res) bind(c)
41 ! ERROR: BIND(C) function result cannot have ALLOCATABLE or POINTER attribute
42 ! ERROR: BIND(C) character function result must have length one
43 character(:), pointer :: res
44 end
46 function func9() result(res) bind(c)
47 ! ERROR: BIND(C) function result cannot be a coarray
48 integer :: res[10, *]
49 end