[feature request] please improve error message for procedure pointer missing nopass attribute

[feature request] please improve error message for procedure pointer missing nopass attribute

Hi,

I find pass/nopass kind of error quite confusing, please consider following code:

program foo
  implicit none

  interface
    subroutine foo_P(dummy)
      implicit none
      real, intent(in) :: dummy
    end subroutine foo_P
  end interface

  type :: foo_T
    procedure(foo_P), pointer :: func
  end type
end program foo

Procedure pointer func in type foo_T is obviously missing nopass attribute. This is what ifort reports:

foo.f90(5): error #8262: The passed-object dummy argument must be dummy data object with the same declared type as the type being defined. [DUMMY]
subroutine foo_P(dummy)
-----------------------^
compilation aborted for foo.f90 (code 1)

It took me quite a while to find the actual cause. To compare that's the output of gfortran-4.6:

foo.f90:12.39:
procedure(foo_P), pointer :: func
                             1
Error: Argument 'dummy' of 'func' with PASS(dummy) at (1) must be of the derived type 'foo_t'

Would it be possible to enhance the compiler logic for this case?
Best regards,
Kacper Kowalik

publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Thanks - I have submitted this as issue DPD200236555. Either NOPASS should be specified or a passed dummy argument should be specified.

Steve - Intel Developer Support

The error message will be improved in a future release. Thanks for the suggestion.

Steve - Intel Developer Support

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya