xref: /llvm-project/flang/test/Semantics/bind-c03.f90 (revision ab7930bd9f088c4fcdfd438b5207a4052c9669b8)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2! Check for C1521
3! If proc-language-binding-spec (bind(c)) is specified, the proc-interface
4! shall appear, it shall be an interface-name, and interface-name shall be
5! declared with a proc-language-binding-spec.
6
7module m
8
9  interface
10    subroutine proc1() bind(c)
11    end
12    subroutine proc2()
13    end
14  end interface
15
16  interface proc3
17    subroutine proc3() bind(c)
18    end
19  end interface
20
21  procedure(proc1), bind(c) :: pc1 ! no error
22  procedure(proc3), bind(c) :: pc4 ! no error
23
24  !ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration
25  procedure(proc2), bind(c) :: pc2
26
27  !ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration
28  procedure(integer), bind(c) :: pc3
29
30  !ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration
31  procedure(), bind(c) :: pc5
32
33end
34