Fortran · 805 bytes Raw Blame History
1 ! audit31 Finding 7: an IMPORT statement inside an interface body
2 ! was reported as a parse error at the `::`. The real cause was
3 ! that parse_function required RESULT before BIND in the function
4 ! header; the test has `bind(...) result(r)`, which left `result(r)`
5 ! unconsumed and shifted every subsequent line one state off. Once
6 ! either ordering is accepted, the IMPORT parse path (already
7 ! implemented in parse_unit_body phase 1.5) kicks in normally.
8 ! Task #488.
9 ! CHECK: ok
10 module audit31_import
11 use iso_c_binding
12 implicit none
13 interface
14 function foo_c(x) bind(C, name="foo") result(r)
15 import :: c_int
16 integer(c_int), value :: x
17 integer(c_int) :: r
18 end function
19 end interface
20 end module
21
22 program p
23 use audit31_import
24 implicit none
25 print *, 'ok'
26 end program
27