2 ! { dg-options "-std=f2003" }
5 ! The compiler should reject internal procedures with BIND(c) attribute
8 subroutine foo() bind(c)
10 subroutine bar() bind (c) ! { dg-error "may not be specified for an internal" }
11 end subroutine bar ! { dg-error "Expected label" }
12 end subroutine foo ! { dg-error "Fortran 2008: CONTAINS statement" }
14 subroutine foo2() bind(c)
17 integer(c_int) function barbar() bind (c) ! { dg-error "may not be specified for an internal" }
18 end function barbar ! { dg-error "Expecting END SUBROUTINE" }
19 end subroutine foo2 ! { dg-error "Fortran 2008: CONTAINS statement" }
21 function one() bind(c)
26 integer(c_int) function two() bind (c) ! { dg-error "may not be specified for an internal" }
27 end function two ! { dg-error "Expected label" }
28 end function one ! { dg-error "Fortran 2008: CONTAINS statement" }
30 function one2() bind(c)
32 integer(c_int) :: one2
35 subroutine three() bind (c) ! { dg-error "may not be specified for an internal" }
36 end subroutine three ! { dg-error "Expecting END FUNCTION statement" }
37 end function one2 ! { dg-error "Fortran 2008: CONTAINS statement" }
43 subroutine test() bind(c) ! { dg-error "may not be specified for an internal" }
44 end subroutine test ! { dg-error "Expecting END PROGRAM" }
45 integer(c_int) function test2() bind (c) ! { dg-error "may not be specified for an internal" }
46 end function test2 ! { dg-error "Expecting END PROGRAM" }
47 end program main ! { dg-error "Fortran 2008: CONTAINS statement" }