As was done recently to allow derived types that are not explicitly BIND(C), but meet the requirements of BIND(C), to be acceptable for use in contexts nominally requiring BIND(C), this patch allows procedures that are not explicitly BIND(C) to be used in contexts that nominally require BIND(C) so long as (1) they meet the requirements of BIND(C), and (2) don't use dummy arguments whose implementations may vary under BIND(C), such as VALUE.
34 lines
1020 B
Fortran
34 lines
1020 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
|
|
! 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
|
|
|
|
interface proc3
|
|
subroutine proc3() bind(c)
|
|
end
|
|
end interface
|
|
|
|
procedure(proc1), bind(c) :: pc1 ! no error
|
|
procedure(proc3), bind(c) :: pc4 ! no error
|
|
|
|
!ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration
|
|
procedure(proc2), bind(c) :: pc2
|
|
|
|
!ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration
|
|
procedure(integer), bind(c) :: pc3
|
|
|
|
!ERROR: An interface name with the BIND attribute must appear if the BIND attribute appears in a procedure declaration
|
|
procedure(), bind(c) :: pc5
|
|
|
|
end
|