ELEMENTAL conflicts with BIND(C).
However, the following is not rejected (diagnosed) by gfortran:
elemental subroutine sub(x)
integer, intent(in) :: x
entry sub_c(x) bind(c)
end subroutine sub
Actually, this is a loop hole in the Fortran 2003 standard, which will be presumably fixed by an erratum. (It passed the J3 ballot, WG3 and ISO approval are still needed.) See F03/0086:
No, it is not allowed. Constraint C1242 was intended to disallow
the combination of elemental and BIND(C), but it inadvertently
failed to cover the case shown in the above example.
Replace C1242 in subclause 126.96.36.199 with
"C1242 An ELEMENTAL procedure shall not have the BIND attribute.".
Draft 2003 corrigendum 3: ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1727.pdf
(Not yet sent to ISO and thus also not ISO approved.)
(In reply to comment #1)
> Draft 2003 corrigendum 3: ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1727.pdf
> (Not yet sent to ISO and thus also not ISO approved.)
That code is now rejected (for a wrong reason), due to PR61765.