PeixinQiao b6713feec7 [flang] Add one semantic check for procedure bind(C) interface-name
As Fortran 2018 C1521, in procedure declaration statement, if
proc-language-binding-spec (bind(c)) is specified, the proc-interface
shall appear, it shall be an interface-name, and interface-name shall
be declared with a proc-language-binding-spec.

Reviewed By: klausler, Jean Perier

Differential Revision: https://reviews.llvm.org/D127121
2022-06-09 00:38:14 +08:00

25 lines
772 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Check for C1521
! If proc-language-binding-spec (bind(c)) is specified, the proc-interface
! shall appear, it shall be an interface-name, and interface-name shall be
! declared with a proc-language-binding-spec.
module m
interface
subroutine proc1() bind(c)
end
subroutine proc2()
end
end interface
procedure(proc1), bind(c) :: pc1 ! no error
!ERROR: An interface name with BIND attribute must be specified if the BIND attribute is specified in a procedure declaration statement
procedure(proc2), bind(c) :: pc2
!ERROR: An interface name with BIND attribute must be specified if the BIND attribute is specified in a procedure declaration statement
procedure(integer), bind(c) :: pc3
end