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