------- Comment #2 from burnus at gcc dot gnu dot org  2009-10-07 08:09 -------
Actually, according to a note (cf. PR 41603 comment 5) the interface actually
could be valid - as long it is not used.

While invoking the function directly is properly rejected, e.g. the following
  c = assumed_len(5)

using it as dummy is accepted:

 module funcs
   implicit none
   integer, parameter :: dp = kind(0.0)
   interface
      function assumed_len(x)
         character(*) assumed_len
         integer, intent(in) :: x
      end function assumed_len
   end interface
contains
  subroutine foo(x)
    procedure(assumed_len) :: x !!! Invalid?!
    ! Check also using an "interface" directly
  end subroutine
  subroutine test()
    call foo(assumed_len)
  end subroutine test
end module funcs



NAG f95 rejects it with:
Error: line 12: ASSUMED_LEN has an implicit interface, therefore it cannot be
used as a proc-interface

while Ifort as mentioned above already does not like the interface.

F95 had Note 5.6 (which is no longer in F2003):

  "An interface body may be specified for a dummy or external function
   whose result has a character length parameter of * only if the function
   is not invoked. This is because this characteristic has to be specified
   to be the same in the interface body as in the procedure definition, but
   in order to invoke such a procedure, the calling routine is required to
   specify a length other than *."


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41604

Reply via email to