Print

Print


Considering the rules relaxed in the language starting with Fortran
2003 regarding specification expressions where a reference to a
specification function is permitted when the arguments to said
function are restricted expressions themselves, is the following code
standard-conforming?

module m
   type :: t(N)
      integer, len :: N
      integer :: i(N)
   end type
contains
   pure function getlen(x) result(r)
      integer, intent(in) :: x
      integer :: r
      r = x
   end function
   function f() result(r)
      type(t(N=getlen(2))) :: r     !!<-- offending line per one compiler
      r%i = 42
   end function
end module

Out of the two compilers I tried, one processed the code without any
error indicators but another complained at the 'type(t(N=getlen(2)))
:: r' declaration statement shown above.

Thanks,
Vipul Parekh

########################################################################

To unsubscribe from the COMP-FORTRAN-90 list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=COMP-FORTRAN-90&A=1